home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / QuickTimeMusic.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  73.3 KB  |  1,777 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QuickTimeMusic.h
  3.  
  4.      Contains:    QuickTime Interfaces.
  5.  
  6.      Version:    Technology:    QuickTime 2.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1990-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QUICKTIMEMUSIC__
  19. #define __QUICKTIMEMUSIC__
  20.  
  21. #ifndef __COMPONENTS__
  22. #include <Components.h>
  23. #endif
  24. #ifndef __IMAGECOMPRESSION__
  25. #include <ImageCompression.h>
  26. #endif
  27. #ifndef __MOVIES__
  28. #include <Movies.h>
  29. #endif
  30. #ifndef __QUICKDRAW__
  31. #include <Quickdraw.h>
  32. #endif
  33. #ifndef __VIDEO__
  34. #include <Video.h>
  35. #endif
  36. #ifndef __SOUND__
  37. #include <Sound.h>
  38. #endif
  39.  
  40.  
  41.  
  42. #if PRAGMA_ONCE
  43. #pragma once
  44. #endif
  45.  
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49.  
  50. #if PRAGMA_IMPORT
  51. #pragma import on
  52. #endif
  53.  
  54. #if PRAGMA_STRUCT_ALIGN
  55.     #pragma options align=mac68k
  56. #elif PRAGMA_STRUCT_PACKPUSH
  57.     #pragma pack(push, 2)
  58. #elif PRAGMA_STRUCT_PACK
  59.     #pragma pack(2)
  60. #endif
  61.  
  62.  
  63. enum {
  64.     kaiToneDescType                = FOUR_CHAR_CODE('tone'),
  65.     kaiNoteRequestInfoType        = FOUR_CHAR_CODE('ntrq'),
  66.     kaiKnobListType                = FOUR_CHAR_CODE('knbl'),
  67.     kaiKeyRangeInfoType            = FOUR_CHAR_CODE('sinf'),
  68.     kaiSampleDescType            = FOUR_CHAR_CODE('sdsc'),
  69.     kaiSampleInfoType            = FOUR_CHAR_CODE('smin'),
  70.     kaiSampleDataType            = FOUR_CHAR_CODE('sdat'),
  71.     kaiInstInfoType                = FOUR_CHAR_CODE('iinf'),
  72.     kaiPictType                    = FOUR_CHAR_CODE('pict'),
  73.     kaiWriterType                = FOUR_CHAR_CODE('©wrt'),
  74.     kaiCopyrightType            = FOUR_CHAR_CODE('©cpy'),
  75.     kaiOtherStrType                = FOUR_CHAR_CODE('str '),
  76.     kaiInstrumentRefType        = FOUR_CHAR_CODE('iref'),
  77.     kaiLibraryInfoType            = FOUR_CHAR_CODE('linf'),
  78.     kaiLibraryDescType            = FOUR_CHAR_CODE('ldsc')
  79. };
  80.  
  81. struct InstLibDescRec {
  82.     Str31                             libIDName;
  83. };
  84. typedef struct InstLibDescRec InstLibDescRec;
  85.  
  86. struct InstKnobRec {
  87.     long                             number;
  88.     long                             value;
  89. };
  90. typedef struct InstKnobRec InstKnobRec;
  91.  
  92.  
  93. enum {
  94.     kInstKnobMissingUnknown        = 0,
  95.     kInstKnobMissingDefault        = 1 << 0
  96. };
  97.  
  98. struct InstKnobList {
  99.     long                             knobCount;
  100.     long                             knobFlags;
  101.     InstKnobRec                     knob[1];
  102. };
  103. typedef struct InstKnobList InstKnobList;
  104.  
  105.  
  106. enum {
  107.     kMusicLoopTypeNormal        = 0,
  108.     kMusicLoopTypePalindrome    = 1                                /* back & forth*/
  109. };
  110.  
  111.  
  112. enum {
  113.     instSamplePreProcessFlag    = 1 << 0
  114. };
  115.  
  116.  
  117. struct InstSampleDescRec {
  118.     OSType                             dataFormat;
  119.     short                             numChannels;
  120.     short                             sampleSize;
  121.     UnsignedFixed                     sampleRate;
  122.     short                             sampleDataID;
  123.     long                             offset;                        /* offset within SampleData - this could be just for internal use*/
  124.     long                             numSamples;                    /* this could also just be for internal use, we'll see*/
  125.  
  126.     long                             loopType;
  127.     long                             loopStart;
  128.     long                             loopEnd;
  129.  
  130.     long                             pitchNormal;
  131.     long                             pitchLow;
  132.     long                             pitchHigh;
  133. };
  134. typedef struct InstSampleDescRec InstSampleDescRec;
  135.  
  136. typedef Handle                             AtomicInstrument;
  137. typedef Ptr                             AtomicInstrumentPtr;
  138.  
  139.  
  140. enum {
  141.     kMusicComponentType            = FOUR_CHAR_CODE('musi')
  142. };
  143.  
  144.  
  145. enum {
  146.     kSoftSynthComponentSubType    = FOUR_CHAR_CODE('ss  '),
  147.     kGMSynthComponentSubType    = FOUR_CHAR_CODE('gm  ')
  148. };
  149.  
  150.  
  151. typedef ComponentInstance                 MusicComponent;
  152. /* MusicSynthesizerFlags*/
  153.  
  154. enum {
  155.     kSynthesizerDynamicVoice    = 1 << 0,                        /* can assign voices on the fly (else, polyphony is very important */
  156.     kSynthesizerUsesMIDIPort    = 1 << 1,                        /* must be patched through MIDI Manager */
  157.     kSynthesizerMicrotone        = 1 << 2,                        /* can play microtonal scales */
  158.     kSynthesizerHasSamples        = 1 << 3,                        /* synthesizer has some use for sampled data */
  159.     kSynthesizerMixedDrums        = 1 << 4,                        /* any part can play drum parts, total = instrument parts */
  160.     kSynthesizerSoftware        = 1 << 5,                        /* implemented in main CPU software == uses cpu cycles */
  161.     kSynthesizerHardware        = 1 << 6,                        /* is a hardware device (such as nubus, or maybe DSP?) */
  162.     kSynthesizerDynamicChannel    = 1 << 7,                        /* can move any part to any channel or disable each part. (else we assume it lives on all channels in masks) */
  163.     kSynthesizerHogsSystemChannel = 1 << 8,                        /* can be channelwise dynamic, but always responds on its system channel */
  164.     kSynthesizerSlowSetPart        = 1 << 10,                        /* SetPart() and SetPartInstrumentNumber() calls do not have rapid response, may glitch notes */
  165.     kSynthesizerOffline            = 1 << 12,                        /* can enter an offline synthesis mode */
  166.     kSynthesizerGM                = 1 << 14,                        /* synth is a GM device */
  167.     kSynthesizerSoundLocalization = 1 << 16                        /* synth is a GM device */
  168. };
  169.  
  170. /*
  171.  * Note that these controller numbers
  172.  * are _not_ identical to the MIDI controller numbers.
  173.  * These are _signed_ 8.8 values, and the LSB's are
  174.  * always sent to a MIDI device. Controllers 32-63 are
  175.  * reserved (for MIDI, they are LSB's for 0-31, but we
  176.  * always send both).
  177.  *
  178.  * The full range, therefore, is -128.00 to 127.7f.
  179.  *
  180.  * _Excepting_ _volume_, all controls default to zero.
  181.  *
  182.  * Pitch bend is specified in fractional semitones! No
  183.  * more "pitch bend range" nonsense. You can bend as far
  184.  * as you want, any time you want.
  185.  */
  186. typedef SInt32                             MusicController;
  187.  
  188. enum {
  189.     kControllerModulationWheel    = 1,
  190.     kControllerBreath            = 2,
  191.     kControllerFoot                = 4,
  192.     kControllerPortamentoTime    = 5,                            /* portamento on/off is omitted, 0 time = 'off' */
  193.     kControllerVolume            = 7,
  194.     kControllerBalance            = 8,
  195.     kControllerPan                = 10,                            /* 0 - "default", 1 - n: positioned in output 1-n (incl fractions) */
  196.     kControllerExpression        = 11,
  197.     kControllerLever1            = 16,                            /* general purpose controllers */
  198.     kControllerLever2            = 17,                            /* general purpose controllers */
  199.     kControllerLever3            = 18,                            /* general purpose controllers */
  200.     kControllerLever4            = 19,                            /* general purpose controllers */
  201.     kControllerLever5            = 80,                            /* general purpose controllers */
  202.     kControllerLever6            = 81,                            /* general purpose controllers */
  203.     kControllerLever7            = 82,                            /* general purpose controllers */
  204.     kControllerLever8            = 83,                            /* general purpose controllers */
  205.     kControllerPitchBend        = 32,                            /* positive & negative semitones, with 7 bits fraction */
  206.     kControllerAfterTouch        = 33,                            /* aka channel pressure */
  207.     kControllerSustain            = 64,                            /* boolean - positive for on, 0 or negative off */
  208.     kControllerSostenuto        = 66,                            /* boolean */
  209.     kControllerSoftPedal        = 67,                            /* boolean */
  210.     kControllerReverb            = 91,
  211.     kControllerTremolo            = 92,
  212.     kControllerChorus            = 93,
  213.     kControllerCeleste            = 94,
  214.     kControllerPhaser            = 95,
  215.     kControllerEditPart            = 113,                            /* last 16 controllers 113-128 and above are global controllers which respond on part zero */
  216.     kControllerMasterTune        = 114
  217. };
  218.  
  219.  
  220. enum {
  221.     kControllerMaximum            = 0x7FFF,                        /* +01111111.11111111 */
  222.     kControllerMinimum            = 0x8000                        /* -10000000.00000000 */
  223. };
  224.  
  225. struct SynthesizerDescription {
  226.     OSType                             synthesizerType;            /* synthesizer type (must be same as component subtype) */
  227.     Str31                             name;                        /* text name of synthesizer type */
  228.     unsigned long                     flags;                        /* from the above enum */
  229.     unsigned long                     voiceCount;                    /* maximum polyphony */
  230.  
  231.     unsigned long                     partCount;                    /* maximum multi-timbrality (and midi channels) */
  232.     unsigned long                     instrumentCount;            /* non gm, built in (rom) instruments only */
  233.     unsigned long                     modifiableInstrumentCount;    /* plus n-more are user modifiable */
  234.     unsigned long                     channelMask;                /* (midi device only) which channels device always uses */
  235.  
  236.     unsigned long                     drumPartCount;                /* maximum multi-timbrality of drum parts */
  237.     unsigned long                     drumCount;                    /* non gm, built in (rom) drumkits only */
  238.     unsigned long                     modifiableDrumCount;        /* plus n-more are user modifiable */
  239.     unsigned long                     drumChannelMask;            /* (midi device only) which channels device always uses */
  240.  
  241.     unsigned long                     outputCount;                /* number of audio outputs (usually two) */
  242.     unsigned long                     latency;                    /* response time in µSec */
  243.  
  244.     unsigned long                     controllers[4];                /* array of 128 bits */
  245.     unsigned long                     gmInstruments[4];            /* array of 128 bits */
  246.     unsigned long                     gmDrums[4];                    /* array of 128 bits */
  247. };
  248. typedef struct SynthesizerDescription SynthesizerDescription;
  249.  
  250.  
  251. enum {
  252.     kVoiceCountDynamic            = -1                            /* constant to use to specify dynamic voicing */
  253. };
  254.  
  255.  
  256. struct ToneDescription {
  257.     OSType                             synthesizerType;            /* synthesizer type */
  258.     Str31                             synthesizerName;            /* name of instantiation of synth */
  259.     Str31                             instrumentName;                /* preferred name for human use */
  260.     long                             instrumentNumber;            /* inst-number used if synth-name matches */
  261.     long                             gmNumber;                    /* Best matching general MIDI number */
  262. };
  263. typedef struct ToneDescription ToneDescription;
  264.  
  265.  
  266. enum {
  267.     kFirstDrumkit                = 16384,                        /* (first value is "no drum". instrument numbers from 16384->16384+128 are drumkits, and for GM they are _defined_ drumkits! */
  268.     kLastDrumkit                = (kFirstDrumkit + 128)
  269. };
  270.  
  271. /* InstrumentMatch*/
  272.  
  273. enum {
  274.     kInstrumentMatchSynthesizerType = 1,
  275.     kInstrumentMatchSynthesizerName = 2,
  276.     kInstrumentMatchName        = 4,
  277.     kInstrumentMatchNumber        = 8,
  278.     kInstrumentMatchGMNumber    = 16
  279. };
  280.  
  281. /* KnobFlags*/
  282.  
  283. enum {
  284.     kKnobReadOnly                = 16,                            /* knob value cannot be changed by user or with a SetKnob call */
  285.     kKnobInterruptUnsafe        = 32,                            /* only alter this knob from foreground task time (may access toolbox) */
  286.     kKnobKeyrangeOverride        = 64,                            /* knob can be overridden within a single keyrange (software synth only) */
  287.     kKnobGroupStart                = 128,                            /* knob is first in some logical group of knobs */
  288.     kKnobFixedPoint8            = 1024,
  289.     kKnobFixedPoint16            = 2048,                            /* One of these may be used at a time. */
  290.     kKnobTypeNumber                = 0 << 12,
  291.     kKnobTypeGroupName            = 1 << 12,                        /* "knob" is really a group name for display purposes */
  292.     kKnobTypeBoolean            = 2 << 12,                        /* if range is greater than 1, its a multi-checkbox field */
  293.     kKnobTypeNote                = 3 << 12,                        /* knob range is equivalent to MIDI keys */
  294.     kKnobTypePan                = 4 << 12,                        /* range goes left/right (lose this? ) */
  295.     kKnobTypeInstrument            = 5 << 12,                        /* knob value = reference to another instrument number */
  296.     kKnobTypeSetting            = 6 << 12,                        /* knob value is 1 of n different things (eg, fm algorithms) popup menu */
  297.     kKnobTypeMilliseconds        = 7 << 12,                        /* knob is a millisecond time range */
  298.     kKnobTypePercentage            = 8 << 12,                        /* knob range is displayed as a Percentage */
  299.     kKnobTypeHertz                = 9 << 12,                        /* knob represents frequency */
  300.     kKnobTypeButton                = 10 << 12                        /* momentary trigger push button */
  301. };
  302.  
  303.  
  304.  
  305. enum {
  306.     kUnknownKnobValue            = 0x7FFFFFFF,                    /* a knob with this value means, we don't know it. */
  307.     kDefaultKnobValue            = 0x7FFFFFFE                    /* used to SET a knob to its default value. */
  308. };
  309.  
  310. struct KnobDescription {
  311.     Str63                             name;
  312.     long                             lowValue;
  313.     long                             highValue;
  314.     long                             defaultValue;                /* a default instrument is made of all default values */
  315.     long                             flags;
  316.     long                             knobID;
  317. };
  318. typedef struct KnobDescription KnobDescription;
  319.  
  320. struct GCInstrumentData {
  321.     ToneDescription                 tone;
  322.     long                             knobCount;
  323.     long                             knob[1];
  324. };
  325. typedef struct GCInstrumentData GCInstrumentData;
  326.  
  327. typedef GCInstrumentData *                GCInstrumentDataPtr;
  328. typedef GCInstrumentDataPtr *            GCInstrumentDataHandle;
  329. struct InstrumentAboutInfo {
  330.     PicHandle                         p;
  331.     Str255                             author;
  332.     Str255                             copyright;
  333.     Str255                             other;
  334. };
  335. typedef struct InstrumentAboutInfo InstrumentAboutInfo;
  336.  
  337.  
  338. enum {
  339.     kMusicPacketPortLost        = 1,                            /* received when application loses the default input port */
  340.     kMusicPacketPortFound        = 2,                            /* received when application gets it back out from under someone else's claim */
  341.     kMusicPacketTimeGap            = 3                                /* data[0] = number of milliseconds to keep the MIDI line silent */
  342. };
  343.  
  344. struct MusicMIDIPacket {
  345.     unsigned short                     length;
  346.     unsigned long                     reserved;                    /* if length zero, then reserved = above enum */
  347.     UInt8                             data[249];
  348. };
  349. typedef struct MusicMIDIPacket MusicMIDIPacket;
  350.  
  351. typedef CALLBACK_API( ComponentResult , MusicMIDISendProcPtr )(MusicComponent self, long refCon, MusicMIDIPacket *mmp);
  352. typedef STACK_UPP_TYPE(MusicMIDISendProcPtr)                     MusicMIDISendUPP;
  353. typedef CALLBACK_API( ComponentResult , MusicMIDIReadHookProcPtr )(MusicMIDIPacket *mp, long myRefCon);
  354. typedef STACK_UPP_TYPE(MusicMIDIReadHookProcPtr)                 MusicMIDIReadHookUPP;
  355.  
  356.  
  357.  
  358. enum {
  359.     notImplementedMusicErr        = (0x80000000 | (0xFFFF & (notImplementedMusicOSErr))),
  360.     cantSendToSynthesizerErr    = (0x80000000 | (0xFFFF & (cantSendToSynthesizerOSErr))),
  361.     cantReceiveFromSynthesizerErr = (0x80000000 | (0xFFFF & (cantReceiveFromSynthesizerOSErr))),
  362.     illegalVoiceAllocationErr    = (0x80000000 | (0xFFFF & (illegalVoiceAllocationOSErr))),
  363.     illegalPartErr                = (0x80000000 | (0xFFFF & (illegalPartOSErr))),
  364.     illegalChannelErr            = (0x80000000 | (0xFFFF & (illegalChannelOSErr))),
  365.     illegalKnobErr                = (0x80000000 | (0xFFFF & (illegalKnobOSErr))),
  366.     illegalKnobValueErr            = (0x80000000 | (0xFFFF & (illegalKnobValueOSErr))),
  367.     illegalInstrumentErr        = (0x80000000 | (0xFFFF & (illegalInstrumentOSErr))),
  368.     illegalControllerErr        = (0x80000000 | (0xFFFF & (illegalControllerOSErr))),
  369.     midiManagerAbsentErr        = (0x80000000 | (0xFFFF & (midiManagerAbsentOSErr))),
  370.     synthesizerNotRespondingErr    = (0x80000000 | (0xFFFF & (synthesizerNotRespondingOSErr))),
  371.     synthesizerErr                = (0x80000000 | (0xFFFF & (synthesizerOSErr))),
  372.     illegalNoteChannelErr        = (0x80000000 | (0xFFFF & (illegalNoteChannelOSErr))),
  373.     noteChannelNotAllocatedErr    = (0x80000000 | (0xFFFF & (noteChannelNotAllocatedOSErr))),
  374.     tunePlayerFullErr            = (0x80000000 | (0xFFFF & (tunePlayerFullOSErr))),
  375.     tuneParseErr                = (0x80000000 | (0xFFFF & (tuneParseOSErr)))
  376. };
  377.  
  378.  
  379. enum {
  380.     kGetAtomicInstNoExpandedSamples = 1 << 0,
  381.     kGetAtomicInstNoOriginalSamples = 1 << 1,
  382.     kGetAtomicInstNoSamples        = kGetAtomicInstNoExpandedSamples | kGetAtomicInstNoOriginalSamples,
  383.     kGetAtomicInstNoKnobList    = 1 << 2,
  384.     kGetAtomicInstNoInstrumentInfo = 1 << 3,
  385.     kGetAtomicInstOriginalKnobList = 1 << 4,
  386.     kGetAtomicInstAllKnobs        = 1 << 5                        /* return even those that are set to default*/
  387. };
  388.  
  389. /*
  390.    For non-gm instruments, instrument number of tone description == 0
  391.    If you want to speed up while running, slam the inst num with what Get instrument number returns
  392.    All missing knobs are slammed to the default value
  393. */
  394.  
  395. enum {
  396.     kSetAtomicInstKeepOriginalInstrument = 1 << 0,
  397.     kSetAtomicInstShareAcrossParts = 1 << 1,                    /* inst disappears when app goes away*/
  398.     kSetAtomicInstCallerTosses    = 1 << 2,                        /* the caller isn't keeping a copy around (for NASetAtomicInstrument)*/
  399.     kSetAtomicInstCallerGuarantees = 1 << 3,                    /* the caller guarantees a copy is around*/
  400.     kSetAtomicInstInterruptSafe    = 1 << 4,                        /* dont move memory at this time (but process at next task time)*/
  401.     kSetAtomicInstDontPreprocess = 1 << 7                        /* perform no further preprocessing because either 1)you know the instrument is digitally clean, or 2) you got it from a GetPartAtomic*/
  402. };
  403.  
  404.  
  405. enum {
  406.     kInstrumentNamesModifiable    = 1,
  407.     kInstrumentNamesBoth        = 2
  408. };
  409.  
  410. /*
  411.  * Structures specific to the GenericMusicComponent
  412.  */
  413.  
  414.  
  415. enum {
  416.     kGenericMusicComponentSubtype = FOUR_CHAR_CODE('gene')
  417. };
  418.  
  419. struct GenericKnobDescription {
  420.     KnobDescription                 kd;
  421.     long                             hw1;                        /* driver defined */
  422.     long                             hw2;                        /* driver defined */
  423.     long                             hw3;                        /* driver defined */
  424.     long                             settingsID;                    /* resource ID list for boolean and popup names */
  425. };
  426. typedef struct GenericKnobDescription GenericKnobDescription;
  427.  
  428. struct GenericKnobDescriptionList {
  429.     long                             knobCount;
  430.     GenericKnobDescription             knob[1];
  431. };
  432. typedef struct GenericKnobDescriptionList GenericKnobDescriptionList;
  433.  
  434. typedef GenericKnobDescriptionList *    GenericKnobDescriptionListPtr;
  435. typedef GenericKnobDescriptionListPtr *    GenericKnobDescriptionListHandle;
  436. /* knobTypes for MusicDerivedSetKnob */
  437.  
  438. enum {
  439.     kGenericMusicKnob            = 1,
  440.     kGenericMusicInstrumentKnob    = 2,
  441.     kGenericMusicDrumKnob        = 3,
  442.     kGenericMusicGlobalController = 4
  443. };
  444.  
  445.  
  446.  
  447.  
  448. enum {
  449.     kGenericMusicResFirst        = 0,
  450.     kGenericMusicResMiscStringList = 1,                            /* STR# 1: synth name, 2:about author,3:aboutcopyright,4:aboutother */
  451.     kGenericMusicResMiscLongList = 2,                            /* Long various params, see list below */
  452.     kGenericMusicResInstrumentList = 3,                            /* NmLs of names and shorts, categories prefixed by '••' */
  453.     kGenericMusicResDrumList    = 4,                            /* NmLs of names and shorts */
  454.     kGenericMusicResInstrumentKnobDescriptionList = 5,            /* Knob */
  455.     kGenericMusicResDrumKnobDescriptionList = 6,                /* Knob */
  456.     kGenericMusicResKnobDescriptionList = 7,                    /* Knob */
  457.     kGenericMusicResBitsLongList = 8,                            /* Long back to back bitmaps of controllers, gminstruments, and drums */
  458.     kGenericMusicResModifiableInstrumentHW = 9,                    /* Shrt same as the hw shorts trailing the instrument names, a shortlist */
  459.     kGenericMusicResGMTranslation = 10,                            /* Long 128 long entries, 1 for each gm inst, of local instrument numbers 1-n (not hw numbers) */
  460.     kGenericMusicResROMInstrumentData = 11,                        /* knob lists for ROM instruments, so the knob values may be known */
  461.     kGenericMusicResAboutPICT    = 12,                            /* picture for aboutlist. must be present for GetAbout call to work */
  462.     kGenericMusicResLast        = 13
  463. };
  464.  
  465. /* elements of the misc long list */
  466.  
  467. enum {
  468.     kGenericMusicMiscLongFirst    = 0,
  469.     kGenericMusicMiscLongVoiceCount = 1,
  470.     kGenericMusicMiscLongPartCount = 2,
  471.     kGenericMusicMiscLongModifiableInstrumentCount = 3,
  472.     kGenericMusicMiscLongChannelMask = 4,
  473.     kGenericMusicMiscLongDrumPartCount = 5,
  474.     kGenericMusicMiscLongModifiableDrumCount = 6,
  475.     kGenericMusicMiscLongDrumChannelMask = 7,
  476.     kGenericMusicMiscLongOutputCount = 8,
  477.     kGenericMusicMiscLongLatency = 9,
  478.     kGenericMusicMiscLongFlags    = 10,
  479.     kGenericMusicMiscLongFirstGMHW = 11,                        /* number to add to locate GM main instruments */
  480.     kGenericMusicMiscLongFirstGMDrumHW = 12,                    /* number to add to locate GM drumkits */
  481.     kGenericMusicMiscLongFirstUserHW = 13,                        /* First hw number of user instruments (presumed sequential) */
  482.     kGenericMusicMiscLongLast    = 14
  483. };
  484.  
  485. struct GCPart {
  486.     long                             hwInstrumentNumber;            /* internal number of recalled instrument */
  487.     short                             controller[128];            /* current values for all controllers */
  488.     long                             volume;                        /* ctrl 7 is special case */
  489.     long                             polyphony;
  490.     long                             midiChannel;                /* 1-16 if in use */
  491.     GCInstrumentData                 id;                            /* ToneDescription & knoblist, uncertain length */
  492. };
  493. typedef struct GCPart GCPart;
  494.  
  495. /*
  496.  * Calls specific to the GenericMusicComponent
  497.  */
  498.  
  499. enum {
  500.     kMusicGenericRange            = 0x0100,
  501.     kMusicDerivedRange            = 0x0200
  502. };
  503.  
  504. /*
  505.  * Flags in GenericMusicConfigure call
  506.  */
  507.  
  508. enum {
  509.     kGenericMusicDoMIDI            = 1 << 0,                        /* implement normal MIDI messages for note, controllers, and program changes 0-127 */
  510.     kGenericMusicBank0            = 1 << 1,                        /* implement instrument bank changes on controller 0 */
  511.     kGenericMusicBank32            = 1 << 2,                        /* implement instrument bank changes on controller 32 */
  512.     kGenericMusicErsatzMIDI        = 1 << 3,                        /* construct MIDI packets, but send them to the derived component */
  513.     kGenericMusicCallKnobs        = 1 << 4,                        /* call the derived component with special knob format call */
  514.     kGenericMusicCallParts        = 1 << 5,                        /* call the derived component with special part format call */
  515.     kGenericMusicCallInstrument    = 1 << 6,                        /* call MusicDerivedSetInstrument for MusicSetInstrument calls */
  516.     kGenericMusicCallNumber        = 1 << 7,                        /* call MusicDerivedSetPartInstrumentNumber for MusicSetPartInstrumentNumber calls, & don't send any C0 or bank stuff */
  517.     kGenericMusicCallROMInstrument = 1 << 8,                    /* call MusicSetInstrument for MusicSetPartInstrumentNumber for "ROM" instruments, passing params from the ROMi resource */
  518.     kGenericMusicAllDefaults    = 1 << 9                        /* indicates that when a new instrument is recalled, all knobs are reset to DEFAULT settings. True for GS modules */
  519. };
  520.  
  521.  
  522.  
  523.  
  524.  
  525. typedef CALLBACK_API( ComponentResult , MusicOfflineDataProcPtr )(Ptr SoundData, long numBytes, long myRefCon);
  526. typedef STACK_UPP_TYPE(MusicOfflineDataProcPtr)                 MusicOfflineDataUPP;
  527. struct OfflineSampleType {
  528.     unsigned long                     numChannels;                /*number of channels,  ie mono = 1*/
  529.     UnsignedFixed                     sampleRate;                    /*sample rate in Apples Fixed point representation*/
  530.     unsigned short                     sampleSize;                    /*number of bits in sample*/
  531. };
  532. typedef struct OfflineSampleType OfflineSampleType;
  533.  
  534. struct InstrumentInfoRecord {
  535.     long                             instrumentNumber;            /* instrument number (if 0, name is a catagory)*/
  536.     long                             flags;                        /* show in picker, etc.*/
  537.     long                             toneNameIndex;                /* index in toneNames (1 based)*/
  538.     long                             itxtNameAtomID;                /* index in itxtNames (itxt/name by index)*/
  539. };
  540. typedef struct InstrumentInfoRecord InstrumentInfoRecord;
  541.  
  542. struct InstrumentInfoList {
  543.     long                             recordCount;
  544.     Handle                             toneNames;                    /* name from tone description*/
  545.     QTAtomContainer                 itxtNames;                    /* itxt/name atoms for instruments*/
  546.     InstrumentInfoRecord             info[1];
  547. };
  548. typedef struct InstrumentInfoList InstrumentInfoList;
  549.  
  550. typedef InstrumentInfoList *            InstrumentInfoListPtr;
  551. typedef InstrumentInfoListPtr *            InstrumentInfoListHandle;
  552. EXTERN_API( ComponentResult )
  553. MusicGetDescription                (MusicComponent         mc,
  554.                                  SynthesizerDescription * sd)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  555.  
  556. EXTERN_API( ComponentResult )
  557. MusicGetPart                    (MusicComponent         mc,
  558.                                  long                     part,
  559.                                  long *                    midiChannel,
  560.                                  long *                    polyphony)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0002, 0x7000, 0xA82A);
  561.  
  562. EXTERN_API( ComponentResult )
  563. MusicSetPart                    (MusicComponent         mc,
  564.                                  long                     part,
  565.                                  long                     midiChannel,
  566.                                  long                     polyphony)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0003, 0x7000, 0xA82A);
  567.  
  568. EXTERN_API( ComponentResult )
  569. MusicSetPartInstrumentNumber    (MusicComponent         mc,
  570.                                  long                     part,
  571.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0004, 0x7000, 0xA82A);
  572.  
  573. #if OLDROUTINENAMES
  574. #define MusicSetInstrumentNumber(ci,part,instrumentNumber) MusicSetPartInstrumentNumber(ci, part,instrumentNumber)
  575. #endif
  576.  
  577. EXTERN_API( ComponentResult )
  578. MusicGetPartInstrumentNumber    (MusicComponent         mc,
  579.                                  long                     part)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  580.  
  581. EXTERN_API( ComponentResult )
  582. MusicStorePartInstrument        (MusicComponent         mc,
  583.                                  long                     part,
  584.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0006, 0x7000, 0xA82A);
  585.  
  586.  
  587. EXTERN_API( ComponentResult )
  588. MusicGetPartAtomicInstrument    (MusicComponent         mc,
  589.                                  long                     part,
  590.                                  AtomicInstrument *        ai,
  591.                                  long                     flags)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0009, 0x7000, 0xA82A);
  592.  
  593. EXTERN_API( ComponentResult )
  594. MusicSetPartAtomicInstrument    (MusicComponent         mc,
  595.                                  long                     part,
  596.                                  AtomicInstrumentPtr     aiP,
  597.                                  long                     flags)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x000A, 0x7000, 0xA82A);
  598.  
  599.  
  600. /* Obsolete calls*/
  601. EXTERN_API( ComponentResult )
  602. MusicGetInstrumentKnobDescriptionObsolete (MusicComponent  mc,
  603.                                  long                     knobIndex,
  604.                                  void *                    mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000D, 0x7000, 0xA82A);
  605.  
  606. EXTERN_API( ComponentResult )
  607. MusicGetDrumKnobDescriptionObsolete (MusicComponent     mc,
  608.                                  long                     knobIndex,
  609.                                  void *                    mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000E, 0x7000, 0xA82A);
  610.  
  611. EXTERN_API( ComponentResult )
  612. MusicGetKnobDescriptionObsolete    (MusicComponent         mc,
  613.                                  long                     knobIndex,
  614.                                  void *                    mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000F, 0x7000, 0xA82A);
  615.  
  616. EXTERN_API( ComponentResult )
  617. MusicGetPartKnob                (MusicComponent         mc,
  618.                                  long                     part,
  619.                                  long                     knobID)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0010, 0x7000, 0xA82A);
  620.  
  621. EXTERN_API( ComponentResult )
  622. MusicSetPartKnob                (MusicComponent         mc,
  623.                                  long                     part,
  624.                                  long                     knobID,
  625.                                  long                     knobValue)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0011, 0x7000, 0xA82A);
  626.  
  627. EXTERN_API( ComponentResult )
  628. MusicGetKnob                    (MusicComponent         mc,
  629.                                  long                     knobID)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0012, 0x7000, 0xA82A);
  630.  
  631. EXTERN_API( ComponentResult )
  632. MusicSetKnob                    (MusicComponent         mc,
  633.                                  long                     knobID,
  634.                                  long                     knobValue)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0013, 0x7000, 0xA82A);
  635.  
  636. EXTERN_API( ComponentResult )
  637. MusicGetPartName                (MusicComponent         mc,
  638.                                  long                     part,
  639.                                  StringPtr                 name)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0014, 0x7000, 0xA82A);
  640.  
  641. EXTERN_API( ComponentResult )
  642. MusicSetPartName                (MusicComponent         mc,
  643.                                  long                     part,
  644.                                  StringPtr                 name)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0015, 0x7000, 0xA82A);
  645.  
  646. EXTERN_API( ComponentResult )
  647. MusicFindTone                    (MusicComponent         mc,
  648.                                  ToneDescription *        td,
  649.                                  long *                    instrumentNumber,
  650.                                  unsigned long *        fit)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0016, 0x7000, 0xA82A);
  651.  
  652. EXTERN_API( ComponentResult )
  653. MusicPlayNote                    (MusicComponent         mc,
  654.                                  long                     part,
  655.                                  long                     pitch,
  656.                                  long                     velocity)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0017, 0x7000, 0xA82A);
  657.  
  658. EXTERN_API( ComponentResult )
  659. MusicResetPart                    (MusicComponent         mc,
  660.                                  long                     part)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0018, 0x7000, 0xA82A);
  661.  
  662. EXTERN_API( ComponentResult )
  663. MusicSetPartController            (MusicComponent         mc,
  664.                                  long                     part,
  665.                                  MusicController         controllerNumber,
  666.                                  long                     controllerValue)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x0019, 0x7000, 0xA82A);
  667.  
  668. #if OLDROUTINENAMES
  669. #define MusicSetController(ci,part,controllerNumber,controllerValue) MusicSetPartController(ci, part,controllerNumber,controllerValue)
  670. #endif
  671.  
  672. EXTERN_API( ComponentResult )
  673. MusicGetPartController            (MusicComponent         mc,
  674.                                  long                     part,
  675.                                  MusicController         controllerNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x001A, 0x7000, 0xA82A);
  676.  
  677. EXTERN_API( ComponentResult )
  678. MusicGetMIDIProc                (MusicComponent         mc,
  679.                                  MusicMIDISendUPP *        midiSendProc,
  680.                                  long *                    refCon)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x001B, 0x7000, 0xA82A);
  681.  
  682. EXTERN_API( ComponentResult )
  683. MusicSetMIDIProc                (MusicComponent         mc,
  684.                                  MusicMIDISendUPP         midiSendProc,
  685.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x001C, 0x7000, 0xA82A);
  686.  
  687. EXTERN_API( ComponentResult )
  688. MusicGetInstrumentNames            (MusicComponent         mc,
  689.                                  long                     modifiableInstruments,
  690.                                  Handle *                instrumentNames,
  691.                                  Handle *                instrumentCategoryLasts,
  692.                                  Handle *                instrumentCategoryNames)            FIVEWORDINLINE(0x2F3C, 0x0010, 0x001D, 0x7000, 0xA82A);
  693.  
  694. EXTERN_API( ComponentResult )
  695. MusicGetDrumNames                (MusicComponent         mc,
  696.                                  long                     modifiableInstruments,
  697.                                  Handle *                instrumentNumbers,
  698.                                  Handle *                instrumentNames)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x001E, 0x7000, 0xA82A);
  699.  
  700. EXTERN_API( ComponentResult )
  701. MusicGetMasterTune                (MusicComponent         mc)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x001F, 0x7000, 0xA82A);
  702.  
  703. EXTERN_API( ComponentResult )
  704. MusicSetMasterTune                (MusicComponent         mc,
  705.                                  long                     masterTune)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0020, 0x7000, 0xA82A);
  706.  
  707.  
  708. EXTERN_API( ComponentResult )
  709. MusicGetInstrumentAboutInfo        (MusicComponent         mc,
  710.                                  long                     part,
  711.                                  InstrumentAboutInfo *    iai)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0022, 0x7000, 0xA82A);
  712.  
  713. EXTERN_API( ComponentResult )
  714. MusicGetDeviceConnection        (MusicComponent         mc,
  715.                                  long                     index,
  716.                                  long *                    id1,
  717.                                  long *                    id2)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0023, 0x7000, 0xA82A);
  718.  
  719. EXTERN_API( ComponentResult )
  720. MusicUseDeviceConnection        (MusicComponent         mc,
  721.                                  long                     id1,
  722.                                  long                     id2)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0024, 0x7000, 0xA82A);
  723.  
  724. EXTERN_API( ComponentResult )
  725. MusicGetKnobSettingStrings        (MusicComponent         mc,
  726.                                  long                     knobIndex,
  727.                                  long                     isGlobal,
  728.                                  Handle *                settingsNames,
  729.                                  Handle *                settingsCategoryLasts,
  730.                                  Handle *                settingsCategoryNames)                FIVEWORDINLINE(0x2F3C, 0x0014, 0x0025, 0x7000, 0xA82A);
  731.  
  732. EXTERN_API( ComponentResult )
  733. MusicGetMIDIPorts                (MusicComponent         mc,
  734.                                  long *                    inputPortCount,
  735.                                  long *                    outputPortCount)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0026, 0x7000, 0xA82A);
  736.  
  737. EXTERN_API( ComponentResult )
  738. MusicSendMIDI                    (MusicComponent         mc,
  739.                                  long                     portIndex,
  740.                                  MusicMIDIPacket *        mp)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0027, 0x7000, 0xA82A);
  741.  
  742. EXTERN_API( ComponentResult )
  743. MusicReceiveMIDI                (MusicComponent         mc,
  744.                                  MusicMIDIReadHookUPP     readHook,
  745.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0028, 0x7000, 0xA82A);
  746.  
  747. EXTERN_API( ComponentResult )
  748. MusicStartOffline                (MusicComponent         mc,
  749.                                  unsigned long *        numChannels,
  750.                                  UnsignedFixed *        sampleRate,
  751.                                  unsigned short *        sampleSize,
  752.                                  MusicOfflineDataUPP     dataProc,
  753.                                  long                     dataProcRefCon)                        FIVEWORDINLINE(0x2F3C, 0x0014, 0x0029, 0x7000, 0xA82A);
  754.  
  755. EXTERN_API( ComponentResult )
  756. MusicSetOfflineTimeTo            (MusicComponent         mc,
  757.                                  long                     newTimeStamp)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x002A, 0x7000, 0xA82A);
  758.  
  759. EXTERN_API( ComponentResult )
  760. MusicGetInstrumentKnobDescription (MusicComponent         mc,
  761.                                  long                     knobIndex,
  762.                                  KnobDescription *        mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x002B, 0x7000, 0xA82A);
  763.  
  764. EXTERN_API( ComponentResult )
  765. MusicGetDrumKnobDescription        (MusicComponent         mc,
  766.                                  long                     knobIndex,
  767.                                  KnobDescription *        mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x002C, 0x7000, 0xA82A);
  768.  
  769. EXTERN_API( ComponentResult )
  770. MusicGetKnobDescription            (MusicComponent         mc,
  771.                                  long                     knobIndex,
  772.                                  KnobDescription *        mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x002D, 0x7000, 0xA82A);
  773.  
  774. EXTERN_API( ComponentResult )
  775. MusicGetInfoText                (MusicComponent         mc,
  776.                                  long                     selector,
  777.                                  Handle *                textH,
  778.                                  Handle *                styleH)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x002E, 0x7000, 0xA82A);
  779.  
  780.  
  781. enum {
  782.     kGetInstrumentInfoNoBuiltIn    = 1 << 0,
  783.     kGetInstrumentInfoMidiUserInst = 1 << 1,
  784.     kGetInstrumentInfoNoIText    = 1 << 2
  785. };
  786.  
  787. EXTERN_API( ComponentResult )
  788. MusicGetInstrumentInfo            (MusicComponent         mc,
  789.                                  long                     getInstrumentInfoFlags,
  790.                                  InstrumentInfoListHandle * infoListH)                        FIVEWORDINLINE(0x2F3C, 0x0008, 0x002F, 0x7000, 0xA82A);
  791.  
  792.  
  793.  
  794.  
  795. EXTERN_API( ComponentResult )
  796. MusicTask                        (MusicComponent         mc)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0031, 0x7000, 0xA82A);
  797.  
  798. EXTERN_API( ComponentResult )
  799. MusicSetPartInstrumentNumberInterruptSafe (MusicComponent  mc,
  800.                                  long                     part,
  801.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0032, 0x7000, 0xA82A);
  802.  
  803. EXTERN_API( ComponentResult )
  804. MusicSetPartSoundLocalization    (MusicComponent         mc,
  805.                                  long                     part,
  806.                                  Handle                 data)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0033, 0x7000, 0xA82A);
  807.  
  808.  
  809.  
  810.  
  811. EXTERN_API( ComponentResult )
  812. MusicGenericConfigure            (MusicComponent         mc,
  813.                                  long                     mode,
  814.                                  long                     flags,
  815.                                  long                     baseResID)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0100, 0x7000, 0xA82A);
  816.  
  817. EXTERN_API( ComponentResult )
  818. MusicGenericGetPart                (MusicComponent         mc,
  819.                                  long                     partNumber,
  820.                                  GCPart **                part)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0101, 0x7000, 0xA82A);
  821.  
  822. EXTERN_API( ComponentResult )
  823. MusicGenericGetKnobList            (MusicComponent         mc,
  824.                                  long                     knobType,
  825.                                  GenericKnobDescriptionListHandle * gkdlH)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0102, 0x7000, 0xA82A);
  826.  
  827. EXTERN_API( ComponentResult )
  828. MusicDerivedMIDISend            (MusicComponent         mc,
  829.                                  MusicMIDIPacket *        packet)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0200, 0x7000, 0xA82A);
  830.  
  831. EXTERN_API( ComponentResult )
  832. MusicDerivedSetKnob                (MusicComponent         mc,
  833.                                  long                     knobType,
  834.                                  long                     knobNumber,
  835.                                  long                     knobValue,
  836.                                  long                     partNumber,
  837.                                  GCPart *                p,
  838.                                  GenericKnobDescription * gkd)                                FIVEWORDINLINE(0x2F3C, 0x0018, 0x0201, 0x7000, 0xA82A);
  839.  
  840. EXTERN_API( ComponentResult )
  841. MusicDerivedSetPart                (MusicComponent         mc,
  842.                                  long                     partNumber,
  843.                                  GCPart *                p)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0202, 0x7000, 0xA82A);
  844.  
  845. EXTERN_API( ComponentResult )
  846. MusicDerivedSetInstrument        (MusicComponent         mc,
  847.                                  long                     partNumber,
  848.                                  GCPart *                p)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0203, 0x7000, 0xA82A);
  849.  
  850. EXTERN_API( ComponentResult )
  851. MusicDerivedSetPartInstrumentNumber (MusicComponent     mc,
  852.                                  long                     partNumber,
  853.                                  GCPart *                p)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0204, 0x7000, 0xA82A);
  854.  
  855. EXTERN_API( ComponentResult )
  856. MusicDerivedSetMIDI                (MusicComponent         mc,
  857.                                  MusicMIDISendProcPtr     midiProc,
  858.                                  long                     refcon,
  859.                                  long                     midiChannel)                        FIVEWORDINLINE(0x2F3C, 0x000C, 0x0205, 0x7000, 0xA82A);
  860.  
  861. EXTERN_API( ComponentResult )
  862. MusicDerivedStorePartInstrument    (MusicComponent         mc,
  863.                                  long                     partNumber,
  864.                                  GCPart *                p,
  865.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x0206, 0x7000, 0xA82A);
  866.  
  867.  
  868.  
  869.  
  870. /* Mask bit for returned value by InstrumentFind.*/
  871.  
  872. enum {
  873.     kInstrumentExactMatch        = 0x00020000,
  874.     kInstrumentRecommendedSubstitute = 0x00010000,
  875.     kInstrumentQualityField        = (long)0xFF000000,
  876.     kInstrumentRoland8BitQuality = 0x05000000
  877. };
  878.  
  879. typedef InstrumentAboutInfo *            InstrumentAboutInfoPtr;
  880. typedef InstrumentAboutInfoPtr *        InstrumentAboutInfoHandle;
  881. struct GMInstrumentInfo {
  882.     long                             cmpInstID;
  883.     long                             gmInstNum;
  884.     long                             instMatch;
  885. };
  886. typedef struct GMInstrumentInfo GMInstrumentInfo;
  887.  
  888. typedef GMInstrumentInfo *                GMInstrumentInfoPtr;
  889. typedef GMInstrumentInfoPtr *            GMInstrumentInfoHandle;
  890. struct nonGMInstrumentInfoRecord {
  891.     long                             cmpInstID;                    /* if 0, category name*/
  892.     long                             flags;                        /* match, show in picker*/
  893.     long                             toneNameIndex;                /* index in toneNames (1 based)*/
  894.     long                             itxtNameAtomID;                /* index in itxtNames (itxt/name by index)*/
  895. };
  896. typedef struct nonGMInstrumentInfoRecord nonGMInstrumentInfoRecord;
  897.  
  898. struct nonGMInstrumentInfo {
  899.     long                             recordCount;
  900.     Handle                             toneNames;                    /* name from tone description*/
  901.     QTAtomContainer                 itxtNames;                    /* itext/name atoms for instruments*/
  902.     nonGMInstrumentInfoRecord         instInfo[1];
  903. };
  904. typedef struct nonGMInstrumentInfo nonGMInstrumentInfo;
  905.  
  906. typedef nonGMInstrumentInfo *            nonGMInstrumentInfoPtr;
  907. typedef nonGMInstrumentInfoPtr *        nonGMInstrumentInfoHandle;
  908. struct InstCompInfo {
  909.     long                             infoSize;                    /* size of this record*/
  910.     Str31                             InstrumentLibraryName;
  911.     QTAtomContainer                 InstrumentLibraryITxt;        /* itext/name atoms for instruments*/
  912.     long                             GMinstrumentCount;
  913.     GMInstrumentInfoHandle             GMinstrumentInfo;
  914.     long                             GMdrumCount;
  915.     GMInstrumentInfoHandle             GMdrumInfo;
  916.     long                             nonGMinstrumentCount;
  917.     nonGMInstrumentInfoHandle         nonGMinstrumentInfo;
  918. };
  919. typedef struct InstCompInfo InstCompInfo;
  920.  
  921. typedef InstCompInfo *                    InstCompInfoPtr;
  922. typedef InstCompInfoPtr *                InstCompInfoHandle;
  923. EXTERN_API( ComponentResult )
  924. InstrumentGetInst                (ComponentInstance         ci,
  925.                                  long                     instID,
  926.                                  AtomicInstrument *        atomicInst,
  927.                                  long                     flags)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0001, 0x7000, 0xA82A);
  928.  
  929. EXTERN_API( ComponentResult )
  930. InstrumentGetInfo                (ComponentInstance         ci,
  931.                                  long                     getInstrumentInfoFlags,
  932.                                  InstCompInfoHandle *    instInfo)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0002, 0x7000, 0xA82A);
  933.  
  934. EXTERN_API( ComponentResult )
  935. InstrumentInitialize            (ComponentInstance         ci,
  936.                                  long                     initFormat,
  937.                                  void *                    initParams)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0003, 0x7000, 0xA82A);
  938.  
  939. EXTERN_API( ComponentResult )
  940. InstrumentOpenComponentResFile    (ComponentInstance         ci,
  941.                                  short *                resFile)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0004, 0x7000, 0xA82A);
  942.  
  943. EXTERN_API( ComponentResult )
  944. InstrumentCloseComponentResFile    (ComponentInstance         ci,
  945.                                  short                     resFile)                            FIVEWORDINLINE(0x2F3C, 0x0002, 0x0005, 0x7000, 0xA82A);
  946.  
  947. EXTERN_API( ComponentResult )
  948. InstrumentGetComponentRefCon    (ComponentInstance         ci,
  949.                                  void **                refCon)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0006, 0x7000, 0xA82A);
  950.  
  951. EXTERN_API( ComponentResult )
  952. InstrumentSetComponentRefCon    (ComponentInstance         ci,
  953.                                  void *                    refCon)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  954.  
  955.  
  956.  
  957. /*--------------------------
  958.     Types
  959. --------------------------*/
  960.  
  961.  
  962. enum {
  963.     kSynthesizerConnectionMono    = 1,                            /* if set, and synth can be mono/poly, then the partCount channels from the system channel are hogged */
  964.     kSynthesizerConnectionMMgr    = 2,                            /* this connection imported from the MIDI Mgr */
  965.     kSynthesizerConnectionOMS    = 4,                            /* this connection imported from OMS */
  966.     kSynthesizerConnectionQT    = 8,                            /* this connection is a QuickTime-only port */
  967.     kSynthesizerConnectionFMS    = 16                            /* this connection imported from FMS */
  968. };
  969.  
  970. /* used for MIDI device only */
  971. struct SynthesizerConnections {
  972.     OSType                             clientID;
  973.     OSType                             inputPortID;                /* terminology death: this port is used to SEND to the midi synth */
  974.     OSType                             outputPortID;                /* terminology death: this port receives from a keyboard or other control device */
  975.     long                             midiChannel;                /* The system channel; others are configurable (or the nubus slot number) */
  976.     long                             flags;
  977.     long                             unique;                        /* unique id may be used instead of index, to getinfo and unregister calls */
  978.     long                             reserved1;                    /* should be zero */
  979.     long                             reserved2;                    /* should be zero */
  980. };
  981. typedef struct SynthesizerConnections SynthesizerConnections;
  982.  
  983. struct QTMIDIPort {
  984.     SynthesizerConnections             portConnections;
  985.     Str63                             portName;
  986. };
  987. typedef struct QTMIDIPort QTMIDIPort;
  988.  
  989.  
  990. enum {
  991.     kNoteRequestNoGM            = 1,                            /* dont degrade to a GM synth */
  992.     kNoteRequestNoSynthType        = 2,                            /* dont degrade to another synth of same type but different name */
  993.     kNoteRequestSynthMustMatch    = 4                                /* synthType must be a match, including kGMSynthComponentSubType */
  994. };
  995.  
  996. typedef ComponentInstance                 NoteAllocator;
  997. struct NoteRequestInfo {
  998.     UInt8                             flags;                        /* 1: dont accept GM match, 2: dont accept same-synth-type match */
  999.     UInt8                             reserved;                    /* must be zero */
  1000.     short                             polyphony;                    /* Maximum number of voices */
  1001.     Fixed                             typicalPolyphony;            /* Hint for level mixing */
  1002. };
  1003. typedef struct NoteRequestInfo NoteRequestInfo;
  1004.  
  1005. struct NoteRequest {
  1006.     NoteRequestInfo                 info;
  1007.     ToneDescription                 tone;
  1008. };
  1009. typedef struct NoteRequest NoteRequest;
  1010.  
  1011. typedef struct OpaqueNoteChannel*         NoteChannel;
  1012.  
  1013.  
  1014.  
  1015. enum {
  1016.     kPickDontMix                = 1,                            /* dont mix instruments with drum sounds */
  1017.     kPickSameSynth                = 2,                            /* only allow the same device that went in, to come out */
  1018.     kPickUserInsts                = 4,                            /* show user insts in addition to ROM voices */
  1019.     kPickEditAllowEdit            = 8,                            /* lets user switch over to edit mode */
  1020.     kPickEditAllowPick            = 16,                            /* lets the user switch over to pick mode */
  1021.     kPickEditSynthGlobal        = 32,                            /* edit the global knobs of the synth */
  1022.     kPickEditControllers        = 64                            /* edit the controllers of the notechannel */
  1023. };
  1024.  
  1025.  
  1026.  
  1027. enum {
  1028.     kNoteAllocatorComponentType    = FOUR_CHAR_CODE('nota')
  1029. };
  1030.  
  1031.  
  1032. /*--------------------------------
  1033.     Note Allocator Prototypes
  1034. --------------------------------*/
  1035. EXTERN_API( ComponentResult )
  1036. NARegisterMusicDevice            (NoteAllocator             ci,
  1037.                                  OSType                 synthType,
  1038.                                  Str31                     name,
  1039.                                  SynthesizerConnections * connections)                        FIVEWORDINLINE(0x2F3C, 0x000C, 0x0000, 0x7000, 0xA82A);
  1040.  
  1041. EXTERN_API( ComponentResult )
  1042. NAUnregisterMusicDevice            (NoteAllocator             ci,
  1043.                                  long                     index)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  1044.  
  1045. EXTERN_API( ComponentResult )
  1046. NAGetRegisteredMusicDevice        (NoteAllocator             ci,
  1047.                                  long                     index,
  1048.                                  OSType *                synthType,
  1049.                                  Str31                     name,
  1050.                                  SynthesizerConnections * connections,
  1051.                                  MusicComponent *        mc)                                    FIVEWORDINLINE(0x2F3C, 0x0014, 0x0002, 0x7000, 0xA82A);
  1052.  
  1053. EXTERN_API( ComponentResult )
  1054. NASaveMusicConfiguration        (NoteAllocator             ci)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0003, 0x7000, 0xA82A);
  1055.  
  1056. EXTERN_API( ComponentResult )
  1057. NANewNoteChannel                (NoteAllocator             ci,
  1058.                                  NoteRequest *            noteRequest,
  1059.                                  NoteChannel *            outChannel)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0004, 0x7000, 0xA82A);
  1060.  
  1061. EXTERN_API( ComponentResult )
  1062. NADisposeNoteChannel            (NoteAllocator             ci,
  1063.                                  NoteChannel             noteChannel)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  1064.  
  1065. EXTERN_API( ComponentResult )
  1066. NAGetNoteChannelInfo            (NoteAllocator             ci,
  1067.                                  NoteChannel             noteChannel,
  1068.                                  long *                    index,
  1069.                                  long *                    part)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0006, 0x7000, 0xA82A);
  1070.  
  1071. EXTERN_API( ComponentResult )
  1072. NAPrerollNoteChannel            (NoteAllocator             ci,
  1073.                                  NoteChannel             noteChannel)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  1074.  
  1075. EXTERN_API( ComponentResult )
  1076. NAUnrollNoteChannel                (NoteAllocator             ci,
  1077.                                  NoteChannel             noteChannel)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0008, 0x7000, 0xA82A);
  1078.  
  1079.  
  1080. EXTERN_API( ComponentResult )
  1081. NASetNoteChannelVolume            (NoteAllocator             ci,
  1082.                                  NoteChannel             noteChannel,
  1083.                                  Fixed                     volume)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000B, 0x7000, 0xA82A);
  1084.  
  1085. EXTERN_API( ComponentResult )
  1086. NAResetNoteChannel                (NoteAllocator             ci,
  1087.                                  NoteChannel             noteChannel)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x000C, 0x7000, 0xA82A);
  1088.  
  1089. EXTERN_API( ComponentResult )
  1090. NAPlayNote                        (NoteAllocator             ci,
  1091.                                  NoteChannel             noteChannel,
  1092.                                  long                     pitch,
  1093.                                  long                     velocity)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x000D, 0x7000, 0xA82A);
  1094.  
  1095. EXTERN_API( ComponentResult )
  1096. NASetController                    (NoteAllocator             ci,
  1097.                                  NoteChannel             noteChannel,
  1098.                                  long                     controllerNumber,
  1099.                                  long                     controllerValue)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x000E, 0x7000, 0xA82A);
  1100.  
  1101. EXTERN_API( ComponentResult )
  1102. NASetKnob                        (NoteAllocator             ci,
  1103.                                  NoteChannel             noteChannel,
  1104.                                  long                     knobNumber,
  1105.                                  long                     knobValue)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x000F, 0x7000, 0xA82A);
  1106.  
  1107. EXTERN_API( ComponentResult )
  1108. NAFindNoteChannelTone            (NoteAllocator             ci,
  1109.                                  NoteChannel             noteChannel,
  1110.                                  ToneDescription *        td,
  1111.                                  long *                    instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x0010, 0x7000, 0xA82A);
  1112.  
  1113. EXTERN_API( ComponentResult )
  1114. NASetInstrumentNumber            (NoteAllocator             ci,
  1115.                                  NoteChannel             noteChannel,
  1116.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0011, 0x7000, 0xA82A);
  1117.  
  1118.  
  1119.  
  1120. #if OLDROUTINENAMES
  1121. #define NASetNoteChannelInstrument(ci, noteChannel,instrumentNumber ) NASetInstrumentNumber(ci, noteChannel,instrumentNumber)
  1122. #define NASetInstrument(ci, noteChannel,instrumentNumber ) NASetInstrumentNumber(ci, noteChannel,instrumentNumber)
  1123. #endif
  1124. EXTERN_API( ComponentResult )
  1125. NAPickInstrument                (NoteAllocator             ci,
  1126.                                  ModalFilterUPP         filterProc,
  1127.                                  StringPtr                 prompt,
  1128.                                  ToneDescription *        sd,
  1129.                                  unsigned long             flags,
  1130.                                  long                     refCon,
  1131.                                  long                     reserved1,
  1132.                                  long                     reserved2)                            FIVEWORDINLINE(0x2F3C, 0x001C, 0x0012, 0x7000, 0xA82A);
  1133.  
  1134. EXTERN_API( ComponentResult )
  1135. NAPickArrangement                (NoteAllocator             ci,
  1136.                                  ModalFilterUPP         filterProc,
  1137.                                  StringPtr                 prompt,
  1138.                                  long                     zero1,
  1139.                                  long                     zero2,
  1140.                                  Track                     t,
  1141.                                  StringPtr                 songName)                            FIVEWORDINLINE(0x2F3C, 0x0018, 0x0013, 0x7000, 0xA82A);
  1142.  
  1143.  
  1144. EXTERN_API( ComponentResult )
  1145. NASetDefaultMIDIInput            (NoteAllocator             ci,
  1146.                                  SynthesizerConnections * sc)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0015, 0x7000, 0xA82A);
  1147.  
  1148. EXTERN_API( ComponentResult )
  1149. NAGetDefaultMIDIInput            (NoteAllocator             ci,
  1150.                                  SynthesizerConnections * sc)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0016, 0x7000, 0xA82A);
  1151.  
  1152.  
  1153. EXTERN_API( ComponentResult )
  1154. NAUseDefaultMIDIInput            (NoteAllocator             ci,
  1155.                                  MusicMIDIReadHookUPP     readHook,
  1156.                                  long                     refCon,
  1157.                                  unsigned long             flags)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0019, 0x7000, 0xA82A);
  1158.  
  1159. EXTERN_API( ComponentResult )
  1160. NALoseDefaultMIDIInput            (NoteAllocator             ci)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x001A, 0x7000, 0xA82A);
  1161.  
  1162. EXTERN_API( ComponentResult )
  1163. NAStuffToneDescription            (NoteAllocator             ci,
  1164.                                  long                     gmNumber,
  1165.                                  ToneDescription *        td)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x001B, 0x7000, 0xA82A);
  1166.  
  1167. EXTERN_API( ComponentResult )
  1168. NACopyrightDialog                (NoteAllocator             ci,
  1169.                                  PicHandle                 p,
  1170.                                  StringPtr                 author,
  1171.                                  StringPtr                 copyright,
  1172.                                  StringPtr                 other,
  1173.                                  StringPtr                 title,
  1174.                                  ModalFilterUPP         filterProc,
  1175.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x001C, 0x001C, 0x7000, 0xA82A);
  1176.  
  1177.  
  1178. /*
  1179.       kNADummyOneSelect = 29
  1180.       kNADummyTwoSelect = 30
  1181. */
  1182.  
  1183. EXTERN_API( ComponentResult )
  1184. NAGetIndNoteChannel                (NoteAllocator             ci,
  1185.                                  long                     index,
  1186.                                  NoteChannel *            nc,
  1187.                                  long *                    seed)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x001F, 0x7000, 0xA82A);
  1188.  
  1189.  
  1190. EXTERN_API( ComponentResult )
  1191. NAGetMIDIPorts                    (NoteAllocator             ci,
  1192.                                  Handle *                inputPorts,
  1193.                                  Handle *                outputPorts)                        FIVEWORDINLINE(0x2F3C, 0x0008, 0x0021, 0x7000, 0xA82A);
  1194.  
  1195. EXTERN_API( ComponentResult )
  1196. NAGetNoteRequest                (NoteAllocator             ci,
  1197.                                  NoteChannel             noteChannel,
  1198.                                  NoteRequest *            nrOut)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0022, 0x7000, 0xA82A);
  1199.  
  1200. EXTERN_API( ComponentResult )
  1201. NASendMIDI                        (NoteAllocator             ci,
  1202.                                  NoteChannel             noteChannel,
  1203.                                  MusicMIDIPacket *        mp)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0023, 0x7000, 0xA82A);
  1204.  
  1205. EXTERN_API( ComponentResult )
  1206. NAPickEditInstrument            (NoteAllocator             ci,
  1207.                                  ModalFilterUPP         filterProc,
  1208.                                  StringPtr                 prompt,
  1209.                                  long                     refCon,
  1210.                                  NoteChannel             nc,
  1211.                                  AtomicInstrument         ai,
  1212.                                  long                     flags)                                FIVEWORDINLINE(0x2F3C, 0x0018, 0x0024, 0x7000, 0xA82A);
  1213.  
  1214. EXTERN_API( ComponentResult )
  1215. NANewNoteChannelFromAtomicInstrument (NoteAllocator     ci,
  1216.                                  AtomicInstrumentPtr     instrument,
  1217.                                  long                     flags,
  1218.                                  NoteChannel *            outChannel)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0025, 0x7000, 0xA82A);
  1219.  
  1220. EXTERN_API( ComponentResult )
  1221. NASetAtomicInstrument            (NoteAllocator             ci,
  1222.                                  NoteChannel             noteChannel,
  1223.                                  AtomicInstrumentPtr     instrument,
  1224.                                  long                     flags)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0026, 0x7000, 0xA82A);
  1225.  
  1226.  
  1227.  
  1228. EXTERN_API( ComponentResult )
  1229. NAGetKnob                        (NoteAllocator             ci,
  1230.                                  NoteChannel             noteChannel,
  1231.                                  long                     knobNumber,
  1232.                                  long *                    knobValue)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0028, 0x7000, 0xA82A);
  1233.  
  1234. EXTERN_API( ComponentResult )
  1235. NATask                            (NoteAllocator             ci)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0029, 0x7000, 0xA82A);
  1236.  
  1237. EXTERN_API( ComponentResult )
  1238. NASetNoteChannelBalance            (NoteAllocator             ci,
  1239.                                  NoteChannel             noteChannel,
  1240.                                  long                     balance)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x002A, 0x7000, 0xA82A);
  1241.  
  1242. EXTERN_API( ComponentResult )
  1243. NASetInstrumentNumberInterruptSafe (NoteAllocator         ci,
  1244.                                  NoteChannel             noteChannel,
  1245.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x002B, 0x7000, 0xA82A);
  1246.  
  1247. EXTERN_API( ComponentResult )
  1248. NASetNoteChannelSoundLocalization (NoteAllocator         ci,
  1249.                                  NoteChannel             noteChannel,
  1250.                                  Handle                 data)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x002C, 0x7000, 0xA82A);
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256. enum {
  1257.     kTuneQueueDepth                = 8                                /* Deepest you can queue tune segments */
  1258. };
  1259.  
  1260.  
  1261. struct TuneStatus {
  1262.     unsigned long *                    tune;                        /* currently playing tune */
  1263.     unsigned long *                    tunePtr;                    /* position within currently playing piece */
  1264.     TimeValue                         time;                        /* current tune time */
  1265.     short                             queueCount;                    /* how many pieces queued up? */
  1266.     short                             queueSpots;                    /* How many more tunepieces can be queued */
  1267.     TimeValue                         queueTime;                    /* How much time is queued up? (can be very inaccurate) */
  1268.     long                             reserved[3];
  1269. };
  1270. typedef struct TuneStatus TuneStatus;
  1271.  
  1272. typedef CALLBACK_API( void , TuneCallBackProcPtr )(const TuneStatus *status, long refCon);
  1273. typedef CALLBACK_API( void , TunePlayCallBackProcPtr )(unsigned long *event, long seed, long refCon);
  1274. typedef STACK_UPP_TYPE(TuneCallBackProcPtr)                     TuneCallBackUPP;
  1275. typedef STACK_UPP_TYPE(TunePlayCallBackProcPtr)                 TunePlayCallBackUPP;
  1276. typedef ComponentInstance                 TunePlayer;
  1277.  
  1278. enum {
  1279.     kTunePlayerType                = FOUR_CHAR_CODE('tune')
  1280. };
  1281.  
  1282.  
  1283. EXTERN_API( ComponentResult )
  1284. TuneSetHeader                    (TunePlayer             tp,
  1285.                                  unsigned long *        header)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0004, 0x7000, 0xA82A);
  1286.  
  1287. EXTERN_API( ComponentResult )
  1288. TuneGetTimeBase                    (TunePlayer             tp,
  1289.                                  TimeBase *                tb)                                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  1290.  
  1291. EXTERN_API( ComponentResult )
  1292. TuneSetTimeScale                (TunePlayer             tp,
  1293.                                  TimeScale                 scale)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0006, 0x7000, 0xA82A);
  1294.  
  1295. EXTERN_API( ComponentResult )
  1296. TuneGetTimeScale                (TunePlayer             tp,
  1297.                                  TimeScale *            scale)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  1298.  
  1299. EXTERN_API( ComponentResult )
  1300. TuneGetIndexedNoteChannel        (TunePlayer             tp,
  1301.                                  long                     i,
  1302.                                  NoteChannel *            nc)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0008, 0x7000, 0xA82A);
  1303.  
  1304.  
  1305. /* Values for when to start. */
  1306.  
  1307. enum {
  1308.     kTuneStartNow                = 1,                            /* start after buffer is implied */
  1309.     kTuneDontClipNotes            = 2,                            /* allow notes to finish their durations outside sample */
  1310.     kTuneExcludeEdgeNotes        = 4,                            /* dont play notes that start at end of tune */
  1311.     kTuneQuickStart                = 8,                            /* Leave all the controllers where they are, ignore start time */
  1312.     kTuneLoopUntil                = 16,                            /* loop a queued tune if there's nothing else in the queue */
  1313.     kTuneStartNewMaster            = 16384
  1314. };
  1315.  
  1316. EXTERN_API( ComponentResult )
  1317. TuneQueue                        (TunePlayer             tp,
  1318.                                  unsigned long *        tune,
  1319.                                  Fixed                     tuneRate,
  1320.                                  unsigned long             tuneStartPosition,
  1321.                                  unsigned long             tuneStopPosition,
  1322.                                  unsigned long             queueFlags,
  1323.                                  TuneCallBackUPP         callBackProc,
  1324.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x001C, 0x000A, 0x7000, 0xA82A);
  1325.  
  1326. EXTERN_API( ComponentResult )
  1327. TuneInstant                        (TunePlayer             tp,
  1328.                                  void *                    tune,
  1329.                                  long                     tunePosition)                        FIVEWORDINLINE(0x2F3C, 0x0008, 0x000B, 0x7000, 0xA82A);
  1330.  
  1331. EXTERN_API( ComponentResult )
  1332. TuneGetStatus                    (TunePlayer             tp,
  1333.                                  TuneStatus *            status)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x000C, 0x7000, 0xA82A);
  1334.  
  1335. /* Values for stopping. */
  1336.  
  1337. enum {
  1338.     kTuneStopFade                = 1,                            /* do a quick, synchronous fadeout */
  1339.     kTuneStopSustain            = 2,                            /* don't silece notes */
  1340.     kTuneStopInstant            = 4,                            /* silence notes fast (else, decay them) */
  1341.     kTuneStopReleaseChannels    = 8                                /* afterwards, let the channels go */
  1342. };
  1343.  
  1344. EXTERN_API( ComponentResult )
  1345. TuneStop                        (TunePlayer             tp,
  1346.                                  long                     stopFlags)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x000D, 0x7000, 0xA82A);
  1347.  
  1348.  
  1349. EXTERN_API( ComponentResult )
  1350. TuneSetVolume                    (TunePlayer             tp,
  1351.                                  Fixed                     volume)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0010, 0x7000, 0xA82A);
  1352.  
  1353. EXTERN_API( ComponentResult )
  1354. TuneGetVolume                    (TunePlayer             tp)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0011, 0x7000, 0xA82A);
  1355.  
  1356. EXTERN_API( ComponentResult )
  1357. TunePreroll                        (TunePlayer             tp)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0012, 0x7000, 0xA82A);
  1358.  
  1359. EXTERN_API( ComponentResult )
  1360. TuneUnroll                        (TunePlayer             tp)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0013, 0x7000, 0xA82A);
  1361.  
  1362. EXTERN_API( ComponentResult )
  1363. TuneSetNoteChannels                (TunePlayer             tp,
  1364.                                  unsigned long             count,
  1365.                                  NoteChannel *            noteChannelList,
  1366.                                  TunePlayCallBackUPP     playCallBackProc,
  1367.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x0010, 0x0014, 0x7000, 0xA82A);
  1368.  
  1369. EXTERN_API( ComponentResult )
  1370. TuneSetPartTranspose            (TunePlayer             tp,
  1371.                                  unsigned long             part,
  1372.                                  long                     transpose,
  1373.                                  long                     velocityShift)                        FIVEWORDINLINE(0x2F3C, 0x000C, 0x0015, 0x7000, 0xA82A);
  1374.  
  1375.  
  1376. EXTERN_API( NoteAllocator )
  1377. TuneGetNoteAllocator            (TunePlayer             tp)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0017, 0x7000, 0xA82A);
  1378.  
  1379. EXTERN_API( ComponentResult )
  1380. TuneSetSofter                    (TunePlayer             tp,
  1381.                                  long                     softer)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0018, 0x7000, 0xA82A);
  1382.  
  1383. EXTERN_API( ComponentResult )
  1384. TuneTask                        (TunePlayer             tp)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0019, 0x7000, 0xA82A);
  1385.  
  1386. EXTERN_API( ComponentResult )
  1387. TuneSetBalance                    (TunePlayer             tp,
  1388.                                  long                     balance)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x001A, 0x7000, 0xA82A);
  1389.  
  1390. EXTERN_API( ComponentResult )
  1391. TuneSetSoundLocalization        (TunePlayer             tp,
  1392.                                  Handle                 data)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x001B, 0x7000, 0xA82A);
  1393.  
  1394. EXTERN_API( ComponentResult )
  1395. TuneSetHeaderWithSize            (TunePlayer             tp,
  1396.                                  unsigned long *        header,
  1397.                                  unsigned long             size)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x001C, 0x7000, 0xA82A);
  1398.  
  1399.  
  1400. typedef unsigned long                     MusicOpWord;
  1401. typedef unsigned long *                    MusicOpWordPtr;
  1402. /*     QuickTime Music Track Event Formats:
  1403.  
  1404.     At this time, QuickTime music tracks support 5 different event types -- REST events,
  1405.     short NOTE events, short CONTROL events, short GENERAL events, Long NOTE events, 
  1406.     long CONTROL events, and variable GENERAL events.
  1407.  
  1408.         • REST Event (4 bytes/event):
  1409.     
  1410.             (0 0 0) (5-bit UNUSED) (24-bit Rest Duration)
  1411.         
  1412.         • Short NOTE Events (4 bytes/event):
  1413.     
  1414.             (0 0 1) (5-bit Part) (6-bit Pitch) (7-bit Volume) (11-bit Duration)
  1415.         
  1416.             where:    Pitch is offset by 32 (Actual pitch = pitch field + 32)
  1417.  
  1418.         • Short CONTROL Events (4 bytes/event):
  1419.     
  1420.             (0 1 0) (5-bit Part) (8-bit Controller) (1-bit UNUSED) (1-bit Sign) (7-bit MSB) (7-bit LSB)
  1421.                                                                          ( or 15-bit Signed Value)
  1422.         • Short GENERAL Event (4 bytes/event):
  1423.     
  1424.             (0 1 1) (1-bit UNUSED) (12-bit Sub-Type) (16-bit Value)
  1425.     
  1426.         • Long NOTE Events (8 bytes/event):
  1427.     
  1428.             (1 0 0 1) (12-bit Part) (1-bit UNUSED) (7-bit Pitch) (1-bit UNUSED) (7-bit Volume)
  1429.             (1 0) (8-bit UNUSED) (22-bit Duration)
  1430.         
  1431.         • Long CONTROL Event (8 bytes/event):
  1432.         
  1433.             (1 0 1 0) (12-bit Part) (16-bit Value MSB) 
  1434.             (1 0) (14-bit Controller) (16-bit Value LSB)
  1435.     
  1436.         • Long KNOB Event (8 bytes/event):
  1437.     
  1438.             (1 0 1 1) (12-bit Sub-Type) (16-bit Value MSB)
  1439.             (1 0) (14-bit KNOB) (16-bit Value LSB)
  1440.     
  1441.         • Variable GENERAL Length Events (N bytes/event):
  1442.     
  1443.             (1 1 1 1) (12-bit Sub-Type) (16-bit Length)
  1444.                 :
  1445.             (32-bit Data values)
  1446.                 :
  1447.             (1 1) (14-bit UNUSED) (16-bit Length)
  1448.     
  1449.             where:    Length field is the number of LONG words in the record.
  1450.                     Lengths include the first and last long words (Minimum length = 2)
  1451.                 
  1452.     The following event type values have not been used yet and are reserved for 
  1453.     future expansion:
  1454.         
  1455.         • (1 0 0 0)        (8 bytes/event)
  1456.         • (1 1 0 0)        (N bytes/event)
  1457.         • (1 1 0 1)        (N bytes/event)
  1458.         • (1 1 1 0)        (N bytes/event)
  1459.         
  1460.     For all events, the following generalizations apply:
  1461.     
  1462.         -    All duration values are specified in Millisecond units.
  1463.         -     Pitch values are intended to map directly to the MIDI key numbers.
  1464.         -    Controllers from 0 to 127 correspond to the standard MIDI controllers.
  1465.             Controllers greater than 127 correspond to other controls (i.e., Pitch Bend, 
  1466.             Key Pressure, and Channel Pressure).    
  1467. */
  1468.  
  1469. /* Defines for the implemented music event data fields*/
  1470.  
  1471. enum {
  1472.     kRestEventType                = 0x00000000,                    /* lower 3-bits */
  1473.     kNoteEventType                = 0x00000001,                    /* lower 3-bits */
  1474.     kControlEventType            = 0x00000002,                    /* lower 3-bits */
  1475.     kMarkerEventType            = 0x00000003,                    /* lower 3-bits */
  1476.     kUndefined1EventType        = 0x00000008,                    /* 4-bits */
  1477.     kXNoteEventType                = 0x00000009,                    /* 4-bits */
  1478.     kXControlEventType            = 0x0000000A,                    /* 4-bits */
  1479.     kKnobEventType                = 0x0000000B,                    /* 4-bits */
  1480.     kUndefined2EventType        = 0x0000000C,                    /* 4-bits */
  1481.     kUndefined3EventType        = 0x0000000D,                    /* 4-bits */
  1482.     kUndefined4EventType        = 0x0000000E,                    /* 4-bits */
  1483.     kGeneralEventType            = 0x0000000F,                    /* 4-bits */
  1484.     kXEventLengthBits            = 0x00000002,                    /* 2 bits: indicates 8-byte event record */
  1485.     kGeneralEventLengthBits        = 0x00000003,                    /* 2 bits: indicates variable length event record */
  1486.     kEventLen                    = 1L,                            /* length of events in long words */
  1487.     kXEventLen                    = 2L,
  1488.     kRestEventLen                = kEventLen,                    /* length of events in long words */
  1489.     kNoteEventLen                = kEventLen,
  1490.     kControlEventLen            = kEventLen,
  1491.     kMarkerEventLen                = kEventLen,
  1492.     kXNoteEventLen                = kXEventLen,
  1493.     kXControlEventLen            = kXEventLen,
  1494.     kGeneralEventLen            = kXEventLen,                    /* 2 or more, however */
  1495.                                                                 /* Universal Event Defines*/
  1496.     kEventLengthFieldPos        = 30,                            /* by looking at these two bits of the 1st or last word              */
  1497.     kEventLengthFieldWidth        = 2,                            /* of an event you can determine the event length                      */
  1498.                                                                 /* length field: 0 & 1 => 1 long; 2 => 2 longs; 3 => variable length */
  1499.     kEventTypeFieldPos            = 29,                            /* event type field for short events */
  1500.     kEventTypeFieldWidth        = 3,                            /* short type is 3 bits */
  1501.     kXEventTypeFieldPos            = 28,                            /* event type field for extended events */
  1502.     kXEventTypeFieldWidth        = 4,                            /* extended type is 4 bits */
  1503.     kEventPartFieldPos            = 24,
  1504.     kEventPartFieldWidth        = 5,
  1505.     kXEventPartFieldPos            = 16,                            /* in the 1st long word */
  1506.     kXEventPartFieldWidth        = 12,                            /* Rest Events*/
  1507.     kRestEventDurationFieldPos    = 0,
  1508.     kRestEventDurationFieldWidth = 24,
  1509.     kRestEventDurationMax        = ((1L << kRestEventDurationFieldWidth) - 1), /* Note Events*/
  1510.     kNoteEventPitchFieldPos        = 18,
  1511.     kNoteEventPitchFieldWidth    = 6,
  1512.     kNoteEventPitchOffset        = 32,                            /* add to value in pitch field to get actual pitch */
  1513.     kNoteEventVolumeFieldPos    = 11,
  1514.     kNoteEventVolumeFieldWidth    = 7,
  1515.     kNoteEventVolumeOffset        = 0,                            /* add to value in volume field to get actual volume */
  1516.     kNoteEventDurationFieldPos    = 0,
  1517.     kNoteEventDurationFieldWidth = 11,
  1518.     kNoteEventDurationMax        = ((1L << kNoteEventDurationFieldWidth) - 1),
  1519.     kXNoteEventPitchFieldPos    = 0,                            /* in the 1st long word */
  1520.     kXNoteEventPitchFieldWidth    = 16,
  1521.     kXNoteEventDurationFieldPos    = 0,                            /* in the 2nd long word */
  1522.     kXNoteEventDurationFieldWidth = 22,
  1523.     kXNoteEventDurationMax        = ((1L << kXNoteEventDurationFieldWidth) - 1),
  1524.     kXNoteEventVolumeFieldPos    = 22,                            /* in the 2nd long word */
  1525.     kXNoteEventVolumeFieldWidth    = 7,                            /* Control Events*/
  1526.     kControlEventControllerFieldPos = 16,
  1527.     kControlEventControllerFieldWidth = 8,
  1528.     kControlEventValueFieldPos    = 0,
  1529.     kControlEventValueFieldWidth = 16,
  1530.     kXControlEventControllerFieldPos = 0,                        /* in the 2nd long word */
  1531.     kXControlEventControllerFieldWidth = 16,
  1532.     kXControlEventValueFieldPos    = 0,                            /* in the 1st long word */
  1533.     kXControlEventValueFieldWidth = 16,                            /* Knob Events*/
  1534.     kKnobEventValueHighFieldPos    = 0,                            /* 1st long word */
  1535.     kKnobEventValueHighFieldWidth = 16,
  1536.     kKnobEventKnobFieldPos        = 16,                            /* 2nd long word */
  1537.     kKnobEventKnobFieldWidth    = 14,
  1538.     kKnobEventValueLowFieldPos    = 0,                            /* 2nd long word */
  1539.     kKnobEventValueLowFieldWidth = 16,                            /* Marker Events*/
  1540.     kMarkerEventSubtypeFieldPos    = 16,
  1541.     kMarkerEventSubtypeFieldWidth = 8,
  1542.     kMarkerEventValueFieldPos    = 0,
  1543.     kMarkerEventValueFieldWidth    = 16,                            /* General Events*/
  1544.     kGeneralEventSubtypeFieldPos = 16,                            /* in the last long word */
  1545.     kGeneralEventSubtypeFieldWidth = 14,
  1546.     kGeneralEventLengthFieldPos    = 0,                            /* in the 1st & last long words */
  1547.     kGeneralEventLengthFieldWidth = 16
  1548. };
  1549.  
  1550.  
  1551.  
  1552. /* macros for extracting various fields from the QuickTime event records*/
  1553. #define qtma_MASK(bitWidth)             ((1L << (bitWidth)) - 1)
  1554. #define qtma_EXT(val, pos, width)         (((val) >> (pos)) & qtma_MASK(width))
  1555. #define qtma_EventLengthForward(xP,ulen)        {        unsigned long _ext;        unsigned long *lP = (unsigned long *)(xP);        _ext = qtma_EXT(*lP, kEventLengthFieldPos, kEventLengthFieldWidth);        if (_ext != 3) {            ulen = (_ext < 2) ? 1 : 2;            } else {            ulen = (unsigned short)qtma_EXT(*lP, kGeneralEventLengthFieldPos, kGeneralEventLengthFieldWidth);        \
  1556.             if (ulen < 2) {            ulen = lP[1];            }            }            }
  1557. #define qtma_EventLengthBackward(xP,ulen)        {        unsigned long _ext;        unsigned long *lP = (unsigned long *)(xP);        _ext = qtma_EXT(*lP, kEventLengthFieldPos, kEventLengthFieldWidth);        if (_ext != 3) {            ulen = (_ext < 2) ? 1 : 2;            } else {            ulen = (unsigned short)qtma_EXT(*lP, kGeneralEventLengthFieldPos, kGeneralEventLengthFieldWidth);        \
  1558.             if (ulen < 2) {            ulen = lP[-1];            }            }            }
  1559. #define qtma_EventType(x)                 ((qtma_EXT(x, kEventTypeFieldPos, kEventTypeFieldWidth) > 3) ? qtma_EXT(x, kXEventTypeFieldPos, kXEventTypeFieldWidth) : qtma_EXT(x, kEventTypeFieldPos, kEventTypeFieldWidth))
  1560. #define qtma_RestDuration(x)              (qtma_EXT(x, kRestEventDurationFieldPos, kRestEventDurationFieldWidth))
  1561. #define qtma_Part(x)                     (qtma_EXT(x, kEventPartFieldPos, kEventPartFieldWidth))
  1562. #define qtma_XPart(m, l)                 (qtma_EXT(m, kXEventPartFieldPos, kXEventPartFieldWidth))
  1563. #define qtma_NotePitch(x)                 (qtma_EXT(x, kNoteEventPitchFieldPos, kNoteEventPitchFieldWidth) + kNoteEventPitchOffset)
  1564. #define qtma_NoteVolume(x)                 (qtma_EXT(x, kNoteEventVolumeFieldPos, kNoteEventVolumeFieldWidth) + kNoteEventVolumeOffset)
  1565. #define qtma_NoteDuration(x)             (qtma_EXT(x, kNoteEventDurationFieldPos, kNoteEventDurationFieldWidth))
  1566. #define qtma_NoteVelocity qtma_NoteVolume
  1567. #define qtma_XNotePitch(m, l)             (qtma_EXT(m, kXNoteEventPitchFieldPos, kXNoteEventPitchFieldWidth))
  1568. #define qtma_XNoteVolume(m, l)             (qtma_EXT(l, kXNoteEventVolumeFieldPos, kXNoteEventVolumeFieldWidth))
  1569. #define qtma_XNoteDuration(m, l)         (qtma_EXT(l, kXNoteEventDurationFieldPos, kXNoteEventDurationFieldWidth))
  1570. #define qtma_XNoteVelocity qtma_XNoteVolume
  1571. #define qtma_ControlController(x)         (qtma_EXT(x, kControlEventControllerFieldPos, kControlEventControllerFieldWidth))
  1572. #define qtma_ControlValue(x)             (qtma_EXT(x, kControlEventValueFieldPos, kControlEventValueFieldWidth))
  1573. #define qtma_XControlController(m, l)     (qtma_EXT(l, kXControlEventControllerFieldPos, kXControlEventControllerFieldWidth))
  1574. #define qtma_XControlValue(m, l)         (qtma_EXT(m, kXControlEventValueFieldPos, kXControlEventValueFieldWidth))
  1575. #define qtma_MarkerSubtype(x)            (qtma_EXT(x,kMarkerEventSubtypeFieldPos,kMarkerEventSubtypeFieldWidth))
  1576. #define qtma_MarkerValue(x)             (qtma_EXT(x, kMarkerEventValueFieldPos, kMarkerEventValueFieldWidth))
  1577. #define qtma_KnobValue(m,l)                ((qtma_EXT(m,kKnobEventValueHighFieldPos,kKnobEventValueHighFieldWidth) << 16)    | (qtma_EXT(l,kKnobEventValueLowFieldPos,kKnobEventValueLowFieldWidth)))
  1578. #define qtma_KnobKnob(m,l)                (qtma_EXT(l,kKnobEventKnobFieldPos,kKnobEventKnobFieldWidth))
  1579. #define qtma_GeneralSubtype(m,l)        (qtma_EXT(l,kGeneralEventSubtypeFieldPos,kGeneralEventSubtypeFieldWidth))
  1580. #define qtma_GeneralLength(m,l)           (qtma_EXT(m,kGeneralEventLengthFieldPos,kGeneralEventLengthFieldWidth))
  1581. #define qtma_StuffRestEvent(x, duration)                                                                x =     (kRestEventType << kEventTypeFieldPos)                                |    ((long)(duration) << kRestEventDurationFieldPos)
  1582. #define qtma_StuffNoteEvent(x, part, pitch, volume, duration)                                                x =     (kNoteEventType << kEventTypeFieldPos)                                    |     ((long)(part) << kEventPartFieldPos)                                    |    (((long)(pitch) - kNoteEventPitchOffset) << kNoteEventPitchFieldPos)    |    (((long)(volume) - kNoteEventVolumeOffset) << kNoteEventVolumeFieldPos)    |    ((long)(duration) << kNoteEventDurationFieldPos)
  1583. #define qtma_StuffControlEvent(x, part, control, value)                                                    x =     (kControlEventType << kEventTypeFieldPos)                            |     ((long)(part) << kEventPartFieldPos)                                |    ((long)(control) << kControlEventControllerFieldPos)                |    ((long)((value) & qtma_MASK(kControlEventValueFieldWidth)) << kControlEventValueFieldPos)
  1584. #define qtma_StuffMarkerEvent(x, markerType, markerValue)                                                x =     (kMarkerEventType << kEventTypeFieldPos)                            |     ((long)(markerType) << kMarkerEventSubtypeFieldPos)                    |    ((long)(markerValue) << kMarkerEventValueFieldPos)                    w1 =     (kXNoteEventType << kXEventTypeFieldPos)                            |    ((long)(part) << kXEventPartFieldPos)                                |    ((long)(pitch) << kXNoteEventPitchFieldPos),                        w2 =    (kXEventLengthBits << kEventLengthFieldPos)                            |    ((long)(duration) << kXNoteEventDurationFieldPos)                    |    ((long)(volume) << kXNoteEventVolumeFieldPos)
  1585. #define qtma_StuffXControlEvent(w1, w2, part, control, value)                                            w1 =     (kXControlEventType << kXEventTypeFieldPos)                            |    ((long)(part) << kXEventPartFieldPos)                                |    ((long)((value) & qtma_MASK(kXControlEventValueFieldWidth)) << kXControlEventValueFieldPos), w2 =    (kXEventLengthBits << kEventLengthFieldPos)                            |    ((long)(control) << kXControlEventControllerFieldPos)
  1586. #define qtma_StuffKnobEvent(w1, w2, part, knob, value)                                                w1 =    (kKnobEventType << kXEventTypeFieldPos)                            |    ((long)(part) << kXEventPartFieldPos)                            |    ((long)(value >> 16) << kKnobEventValueLowFieldPos),            w2 =    (kXEventLengthBits << kEventLengthFieldPos)                        |    ((long)(knob) << kKnobEventKnobFieldPos)                        |    ((long)(value & 0xFFFF) << kKnobEventValueLowFieldPos)
  1587. #define qtma_StuffGeneralEvent(w1,w2,part,subType,length)                                            w1 =    (kGeneralEventType << kXEventTypeFieldPos)                        |    ((long)(part) << kXEventPartFieldPos)                            |    ((long)(length) << kGeneralEventLengthFieldPos),                w2 =    (kGeneralEventLengthBits << kEventLengthFieldPos)                |    ((long)(subType) << kGeneralEventSubtypeFieldPos)                |    ((long)(length) << kGeneralEventLengthFieldPos)
  1588. #define qtma_NeedXGeneralEvent(length)     (((unsigned long)(length)) > (unsigned long)0xffff)
  1589.  
  1590.  
  1591. /* General Event Defined Types*/
  1592.  
  1593. enum {
  1594.     kGeneralEventNoteRequest    = 1,                            /* Encapsulates NoteRequest data structure */
  1595.     kGeneralEventPartKey        = 4,
  1596.     kGeneralEventTuneDifference    = 5,                            /* Contains a standard sequence, with end marker, for the tune difference of a sequence piece (halts QuickTime 2.0 Music) */
  1597.     kGeneralEventAtomicInstrument = 6,                            /* Encapsulates AtomicInstrument record */
  1598.     kGeneralEventKnob            = 7,                            /* knobID/knobValue pairs; smallest event is 4 longs */
  1599.     kGeneralEventMIDIChannel    = 8,                            /* used in tune header, one longword identifies the midi channel it originally came from */
  1600.     kGeneralEventPartChange        = 9,                            /* used in tune sequence, one longword identifies the tune part which can now take over this part's note channel (similar to program change) (halts QuickTime 2.0 Music)*/
  1601.     kGeneralEventNoOp            = 10,                            /* guaranteed to do nothing and be ignored. (halts QuickTime 2.0 Music) */
  1602.     kGeneralEventUsedNotes        = 11                            /* four longwords specifying which midi notes are actually used, 0..127 msb to lsb */
  1603. };
  1604.  
  1605. /* Marker Event Defined Types        // marker is 60 ee vv vv in hex, where e = event type, and v = value*/
  1606.  
  1607. enum {
  1608.     kMarkerEventEnd                = 0,                            /* marker type 0 means: value 0 - stop, value != 0 - ignore*/
  1609.     kMarkerEventBeat            = 1,                            /* value 0 = single beat; anything else is 65536ths-of-a-beat (quarter note)*/
  1610.     kMarkerEventTempo            = 2                                /* value same as beat marker, but indicates that a tempo event should be computed (based on where the next beat or tempo marker is) and emitted upon export*/
  1611. };
  1612.  
  1613.  
  1614.  
  1615. /* UPP call backs */
  1616. enum { uppMusicMIDISendProcInfo = 0x00000FF0 };                 /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  1617. enum { uppMusicMIDIReadHookProcInfo = 0x000003F0 };             /* pascal 4_bytes Func(4_bytes, 4_bytes) */
  1618. enum { uppMusicOfflineDataProcInfo = 0x00000FF0 };                 /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  1619. enum { uppTuneCallBackProcInfo = 0x000003C0 };                     /* pascal no_return_value Func(4_bytes, 4_bytes) */
  1620. enum { uppTunePlayCallBackProcInfo = 0x00000FC0 };                 /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  1621. #define NewMusicMIDISendProc(userRoutine)                         (MusicMIDISendUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMusicMIDISendProcInfo, GetCurrentArchitecture())
  1622. #define NewMusicMIDIReadHookProc(userRoutine)                     (MusicMIDIReadHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMusicMIDIReadHookProcInfo, GetCurrentArchitecture())
  1623. #define NewMusicOfflineDataProc(userRoutine)                     (MusicOfflineDataUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMusicOfflineDataProcInfo, GetCurrentArchitecture())
  1624. #define NewTuneCallBackProc(userRoutine)                         (TuneCallBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTuneCallBackProcInfo, GetCurrentArchitecture())
  1625. #define NewTunePlayCallBackProc(userRoutine)                     (TunePlayCallBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTunePlayCallBackProcInfo, GetCurrentArchitecture())
  1626. #define CallMusicMIDISendProc(userRoutine, self, refCon, mmp)     CALL_THREE_PARAMETER_UPP((userRoutine), uppMusicMIDISendProcInfo, (self), (refCon), (mmp))
  1627. #define CallMusicMIDIReadHookProc(userRoutine, mp, myRefCon)     CALL_TWO_PARAMETER_UPP((userRoutine), uppMusicMIDIReadHookProcInfo, (mp), (myRefCon))
  1628. #define CallMusicOfflineDataProc(userRoutine, SoundData, numBytes, myRefCon)  CALL_THREE_PARAMETER_UPP((userRoutine), uppMusicOfflineDataProcInfo, (SoundData), (numBytes), (myRefCon))
  1629. #define CallTuneCallBackProc(userRoutine, status, refCon)         CALL_TWO_PARAMETER_UPP((userRoutine), uppTuneCallBackProcInfo, (status), (refCon))
  1630. #define CallTunePlayCallBackProc(userRoutine, event, seed, refCon)  CALL_THREE_PARAMETER_UPP((userRoutine), uppTunePlayCallBackProcInfo, (event), (seed), (refCon))
  1631.  
  1632. /* selectors for component calls */
  1633. enum {
  1634.     kMusicGetDescriptionSelect                        = 0x0001,
  1635.     kMusicGetPartSelect                                = 0x0002,
  1636.     kMusicSetPartSelect                                = 0x0003,
  1637.     kMusicSetPartInstrumentNumberSelect                = 0x0004,
  1638.     kMusicGetPartInstrumentNumberSelect                = 0x0005,
  1639.     kMusicStorePartInstrumentSelect                    = 0x0006,
  1640.     kMusicGetPartAtomicInstrumentSelect                = 0x0009,
  1641.     kMusicSetPartAtomicInstrumentSelect                = 0x000A,
  1642.     kMusicGetInstrumentKnobDescriptionObsoleteSelect = 0x000D,
  1643.     kMusicGetDrumKnobDescriptionObsoleteSelect        = 0x000E,
  1644.     kMusicGetKnobDescriptionObsoleteSelect            = 0x000F,
  1645.     kMusicGetPartKnobSelect                            = 0x0010,
  1646.     kMusicSetPartKnobSelect                            = 0x0011,
  1647.     kMusicGetKnobSelect                                = 0x0012,
  1648.     kMusicSetKnobSelect                                = 0x0013,
  1649.     kMusicGetPartNameSelect                            = 0x0014,
  1650.     kMusicSetPartNameSelect                            = 0x0015,
  1651.     kMusicFindToneSelect                            = 0x0016,
  1652.     kMusicPlayNoteSelect                            = 0x0017,
  1653.     kMusicResetPartSelect                            = 0x0018,
  1654.     kMusicSetPartControllerSelect                    = 0x0019,
  1655.     kMusicGetPartControllerSelect                    = 0x001A,
  1656.     kMusicGetMIDIProcSelect                            = 0x001B,
  1657.     kMusicSetMIDIProcSelect                            = 0x001C,
  1658.     kMusicGetInstrumentNamesSelect                    = 0x001D,
  1659.     kMusicGetDrumNamesSelect                        = 0x001E,
  1660.     kMusicGetMasterTuneSelect                        = 0x001F,
  1661.     kMusicSetMasterTuneSelect                        = 0x0020,
  1662.     kMusicGetInstrumentAboutInfoSelect                = 0x0022,
  1663.     kMusicGetDeviceConnectionSelect                    = 0x0023,
  1664.     kMusicUseDeviceConnectionSelect                    = 0x0024,
  1665.     kMusicGetKnobSettingStringsSelect                = 0x0025,
  1666.     kMusicGetMIDIPortsSelect                        = 0x0026,
  1667.     kMusicSendMIDISelect                            = 0x0027,
  1668.     kMusicReceiveMIDISelect                            = 0x0028,
  1669.     kMusicStartOfflineSelect                        = 0x0029,
  1670.     kMusicSetOfflineTimeToSelect                    = 0x002A,
  1671.     kMusicGetInstrumentKnobDescriptionSelect        = 0x002B,
  1672.     kMusicGetDrumKnobDescriptionSelect                = 0x002C,
  1673.     kMusicGetKnobDescriptionSelect                    = 0x002D,
  1674.     kMusicGetInfoTextSelect                            = 0x002E,
  1675.     kMusicGetInstrumentInfoSelect                    = 0x002F,
  1676.     kMusicTaskSelect                                = 0x0031,
  1677.     kMusicSetPartInstrumentNumberInterruptSafeSelect = 0x0032,
  1678.     kMusicSetPartSoundLocalizationSelect            = 0x0033,
  1679.     kMusicGenericConfigureSelect                    = 0x0100,
  1680.     kMusicGenericGetPartSelect                        = 0x0101,
  1681.     kMusicGenericGetKnobListSelect                    = 0x0102,
  1682.     kMusicDerivedMIDISendSelect                        = 0x0200,
  1683.     kMusicDerivedSetKnobSelect                        = 0x0201,
  1684.     kMusicDerivedSetPartSelect                        = 0x0202,
  1685.     kMusicDerivedSetInstrumentSelect                = 0x0203,
  1686.     kMusicDerivedSetPartInstrumentNumberSelect        = 0x0204,
  1687.     kMusicDerivedSetMIDISelect                        = 0x0205,
  1688.     kMusicDerivedStorePartInstrumentSelect            = 0x0206,
  1689.     kInstrumentGetInstSelect                        = 0x0001,
  1690.     kInstrumentGetInfoSelect                        = 0x0002,
  1691.     kInstrumentInitializeSelect                        = 0x0003,
  1692.     kInstrumentOpenComponentResFileSelect            = 0x0004,
  1693.     kInstrumentCloseComponentResFileSelect            = 0x0005,
  1694.     kInstrumentGetComponentRefConSelect                = 0x0006,
  1695.     kInstrumentSetComponentRefConSelect                = 0x0007,
  1696.     kNARegisterMusicDeviceSelect                    = 0x0000,
  1697.     kNAUnregisterMusicDeviceSelect                    = 0x0001,
  1698.     kNAGetRegisteredMusicDeviceSelect                = 0x0002,
  1699.     kNASaveMusicConfigurationSelect                    = 0x0003,
  1700.     kNANewNoteChannelSelect                            = 0x0004,
  1701.     kNADisposeNoteChannelSelect                        = 0x0005,
  1702.     kNAGetNoteChannelInfoSelect                        = 0x0006,
  1703.     kNAPrerollNoteChannelSelect                        = 0x0007,
  1704.     kNAUnrollNoteChannelSelect                        = 0x0008,
  1705.     kNASetNoteChannelVolumeSelect                    = 0x000B,
  1706.     kNAResetNoteChannelSelect                        = 0x000C,
  1707.     kNAPlayNoteSelect                                = 0x000D,
  1708.     kNASetControllerSelect                            = 0x000E,
  1709.     kNASetKnobSelect                                = 0x000F,
  1710.     kNAFindNoteChannelToneSelect                    = 0x0010,
  1711.     kNASetInstrumentNumberSelect                    = 0x0011,
  1712.     kNAPickInstrumentSelect                            = 0x0012,
  1713.     kNAPickArrangementSelect                        = 0x0013,
  1714.     kNASetDefaultMIDIInputSelect                    = 0x0015,
  1715.     kNAGetDefaultMIDIInputSelect                    = 0x0016,
  1716.     kNAUseDefaultMIDIInputSelect                    = 0x0019,
  1717.     kNALoseDefaultMIDIInputSelect                    = 0x001A,
  1718.     kNAStuffToneDescriptionSelect                    = 0x001B,
  1719.     kNACopyrightDialogSelect                        = 0x001C,
  1720.     kNAGetIndNoteChannelSelect                        = 0x001F,
  1721.     kNAGetMIDIPortsSelect                            = 0x0021,
  1722.     kNAGetNoteRequestSelect                            = 0x0022,
  1723.     kNASendMIDISelect                                = 0x0023,
  1724.     kNAPickEditInstrumentSelect                        = 0x0024,
  1725.     kNANewNoteChannelFromAtomicInstrumentSelect        = 0x0025,
  1726.     kNASetAtomicInstrumentSelect                    = 0x0026,
  1727.     kNAGetKnobSelect                                = 0x0028,
  1728.     kNATaskSelect                                    = 0x0029,
  1729.     kNASetNoteChannelBalanceSelect                    = 0x002A,
  1730.     kNASetInstrumentNumberInterruptSafeSelect        = 0x002B,
  1731.     kNASetNoteChannelSoundLocalizationSelect        = 0x002C,
  1732.     kTuneSetHeaderSelect                            = 0x0004,
  1733.     kTuneGetTimeBaseSelect                            = 0x0005,
  1734.     kTuneSetTimeScaleSelect                            = 0x0006,
  1735.     kTuneGetTimeScaleSelect                            = 0x0007,
  1736.     kTuneGetIndexedNoteChannelSelect                = 0x0008,
  1737.     kTuneQueueSelect                                = 0x000A,
  1738.     kTuneInstantSelect                                = 0x000B,
  1739.     kTuneGetStatusSelect                            = 0x000C,
  1740.     kTuneStopSelect                                    = 0x000D,
  1741.     kTuneSetVolumeSelect                            = 0x0010,
  1742.     kTuneGetVolumeSelect                            = 0x0011,
  1743.     kTunePrerollSelect                                = 0x0012,
  1744.     kTuneUnrollSelect                                = 0x0013,
  1745.     kTuneSetNoteChannelsSelect                        = 0x0014,
  1746.     kTuneSetPartTransposeSelect                        = 0x0015,
  1747.     kTuneGetNoteAllocatorSelect                        = 0x0017,
  1748.     kTuneSetSofterSelect                            = 0x0018,
  1749.     kTuneTaskSelect                                    = 0x0019,
  1750.     kTuneSetBalanceSelect                            = 0x001A,
  1751.     kTuneSetSoundLocalizationSelect                    = 0x001B,
  1752.     kTuneSetHeaderWithSizeSelect                    = 0x001C
  1753. };
  1754.  
  1755.  
  1756.  
  1757. #if PRAGMA_STRUCT_ALIGN
  1758.     #pragma options align=reset
  1759. #elif PRAGMA_STRUCT_PACKPUSH
  1760.     #pragma pack(pop)
  1761. #elif PRAGMA_STRUCT_PACK
  1762.     #pragma pack()
  1763. #endif
  1764.  
  1765. #ifdef PRAGMA_IMPORT_OFF
  1766. #pragma import off
  1767. #elif PRAGMA_IMPORT
  1768. #pragma import reset
  1769. #endif
  1770.  
  1771. #ifdef __cplusplus
  1772. }
  1773. #endif
  1774.  
  1775. #endif /* __QUICKTIMEMUSIC__ */
  1776.  
  1777.